Implements basic numerical tables
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-09 20:15:09 +02:00
parent ec2419bc7d
commit 081def0be0
21 changed files with 324 additions and 24 deletions

View File

@@ -14,11 +14,20 @@
class ScriptFunctionEvalValue : public EvalValue{
std::shared_ptr<BoundBlockStatement> _innerBlock;
std::shared_ptr<FunctionScriptType> _type;
std::size_t _hash;
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock, std::shared_ptr<FunctionScriptType> type, size_t hash)
: _type(std::move(type))
{
_innerBlock = std::move(innerBlock);
_hash = hash;
}
public:
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock, std::shared_ptr<FunctionScriptType> type)
: _type(std::move(type))
{
_innerBlock = std::move(innerBlock);
_hash = rand();
}
std::shared_ptr<ScriptType> GetType() final{
@@ -26,20 +35,25 @@ public:
}
shared_ptr<EvalValue> Clone() final{
return make_shared<ScriptFunctionEvalValue>(_innerBlock, _type);
return shared_ptr<ScriptFunctionEvalValue>(new ScriptFunctionEvalValue(_innerBlock, _type, _hash));
}
bool operator ==(EvalValue* b) final{
if (b->GetType()->GetClass() != TypeClass::Function)
return false;
return this->_innerBlock == ((ScriptFunctionEvalValue*)b)->_innerBlock;
return this->_hash == ((ScriptFunctionEvalValue*)b)->_hash;
};
std::shared_ptr<BoundBlockStatement> GetInnerBlock(){
return _innerBlock;
}
std::size_t GetHashCode(){
return _hash;
}
};