Implements variable usage, tweaks and fixes for variable assignment
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
class EvalValue{
|
||||
public:
|
||||
EvalValue() = default;
|
||||
virtual ~EvalValue() = default;
|
||||
virtual ScriptType* GetType() = 0;
|
||||
|
||||
@@ -18,6 +19,8 @@ public:
|
||||
return ! (this->operator==(b));
|
||||
}
|
||||
|
||||
virtual EvalValue* Clone() = 0;
|
||||
|
||||
virtual long EvaluateInteger(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
||||
}
|
||||
@@ -41,6 +44,10 @@ public:
|
||||
_type = new ScriptType(TypeClass::Bool);
|
||||
}
|
||||
|
||||
EvalValue* Clone() final{
|
||||
return new BooleanEvalValue(_value);
|
||||
}
|
||||
|
||||
~BooleanEvalValue() final{
|
||||
delete _type;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ public:
|
||||
strs << _value;
|
||||
return strs.str();
|
||||
}
|
||||
|
||||
EvalValue* Clone() final{
|
||||
return new IntegerEvalValue(_value);
|
||||
}
|
||||
};
|
||||
|
||||
class FloatEvalValue : public NumericEvalValue{
|
||||
@@ -74,6 +78,10 @@ public:
|
||||
strs << _value;
|
||||
return strs.str();
|
||||
}
|
||||
|
||||
EvalValue* Clone() final{
|
||||
return new FloatEvalValue(_value);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_NUMERICEVALVALUE_HPP
|
||||
|
||||
@@ -32,6 +32,9 @@ public:
|
||||
return _value;
|
||||
}
|
||||
|
||||
EvalValue* Clone() final{
|
||||
return new StringEvalValue(_value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user