Added equality operation for eval values
This commit is contained in:
@@ -11,6 +11,12 @@ public:
|
||||
virtual ~EvalValue() = default;
|
||||
virtual ScriptType* GetType() = 0;
|
||||
|
||||
virtual bool operator ==(EvalValue* b) = 0;
|
||||
|
||||
virtual bool operator !=(EvalValue*b){
|
||||
return ! (this->operator==(b));
|
||||
}
|
||||
|
||||
virtual long EvaluateInteger(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
||||
}
|
||||
@@ -45,6 +51,12 @@ public:
|
||||
bool EvaluateBool() final{
|
||||
return _value;
|
||||
}
|
||||
|
||||
bool operator ==(EvalValue* b) final{
|
||||
if (b->GetType()->GetClass() != TypeClass::Bool)
|
||||
return false;
|
||||
return this->EvaluateBool() == b->EvaluateBool();
|
||||
};
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_EVALVALUE_HPP
|
||||
|
||||
Reference in New Issue
Block a user