Greatly simplify handling numerical eval values, using std::variant
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-09-07 10:57:09 +02:00
parent 7b5d03ed74
commit 5d700aa0e9
12 changed files with 183 additions and 393 deletions

View File

@@ -18,7 +18,7 @@ namespace Porygon::UserData{
}
const Evaluation::EvalValue* GetCurrent() final{
return new Evaluation::IntegerEvalValue(_current);
return new Evaluation::NumericEvalValue(static_cast<int64_t>(_current));
}
bool MoveNext() final{
_current ++;

View File

@@ -51,11 +51,11 @@
#define PORYGON_INTEGER_FIELD(fieldName) \
PORYGON_FIELD(fieldName, PORYGON_INTEGER_TYPE, \
const Porygon::Evaluation::IntegerEvalValue(((T_USERDATA*)obj)->fieldName), val->EvaluateInteger())
const Porygon::Evaluation::NumericEvalValue(((T_USERDATA*)obj)->fieldName), val->EvaluateInteger())
#define PORYGON_READONLY_INTEGER_FIELD(fieldName) \
PORYGON_READONLY_FIELD(fieldName, PORYGON_INTEGER_TYPE, \
Porygon::Evaluation::IntegerEvalValue(((T_USERDATA*)obj)->fieldName))
Porygon::Evaluation::NumericEvalValue(((T_USERDATA*)obj)->fieldName))
#define PORYGON_FLOAT_FIELD(fieldName) \
PORYGON_FIELD(fieldName, PORYGON_FLOAT_TYPE, \