PorygonLang/src/Evaluator/EvalValues/TableEvalValue.cpp

16 lines
597 B
C++

#include "TableEvalValue.hpp"
#include "../Iterator/SimpleKeyIterator.hpp"
#include "NumericEvalValue.hpp"
inline Porygon::Evaluation::Iterator * Porygon::Evaluation::TableEvalValue::GetKeyIterator() const {
return new TableKeyIterator(this);
}
Porygon::Evaluation::EvalValue *
Porygon::Evaluation::TableEvalValue::UnaryOperation(Porygon::Binder::BoundUnaryOperation operation) const {
if (operation == Porygon::Binder::BoundUnaryOperation::Count){
return new NumericEvalValue(static_cast<int64_t>(this->_table->size()));
}
return EvalValue::UnaryOperation(operation);
}