Work on performance improvements
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,7 +12,7 @@ class EvalValue{
|
||||
public:
|
||||
EvalValue() = default;
|
||||
virtual ~EvalValue() = default;
|
||||
virtual std::shared_ptr<ScriptType> GetType() = 0;
|
||||
virtual const TypeClass GetTypeClass() = 0;
|
||||
|
||||
virtual bool operator ==(EvalValue* b) = 0;
|
||||
|
||||
@@ -43,28 +43,27 @@ public:
|
||||
};
|
||||
|
||||
class BooleanEvalValue : public EvalValue{
|
||||
bool _value;
|
||||
std::shared_ptr<ScriptType> _type;
|
||||
const bool _value;
|
||||
public:
|
||||
explicit BooleanEvalValue(bool val){
|
||||
_value = val;
|
||||
_type = std::make_shared<ScriptType>(TypeClass::Bool);
|
||||
explicit BooleanEvalValue(bool val)
|
||||
: _value(val)
|
||||
{
|
||||
}
|
||||
|
||||
shared_ptr<EvalValue> Clone() final{
|
||||
return make_shared<BooleanEvalValue>(_value);
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptType> GetType() final{
|
||||
return _type;
|
||||
};
|
||||
const TypeClass GetTypeClass() final{
|
||||
return TypeClass ::Bool;
|
||||
}
|
||||
|
||||
bool EvaluateBool() final{
|
||||
return _value;
|
||||
}
|
||||
|
||||
bool operator ==(EvalValue* b) final{
|
||||
if (b->GetType()->GetClass() != TypeClass::Bool)
|
||||
if (b->GetTypeClass() != TypeClass::Bool)
|
||||
return false;
|
||||
return this->EvaluateBool() == b->EvaluateBool();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user