Work on performance improvements
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-13 16:26:10 +02:00
parent e93bcab14d
commit 1cb65f17c9
19 changed files with 84 additions and 108 deletions

View File

@@ -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();
};