Handle bound classes as constants during evaluation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-13 17:12:46 +02:00
parent 1cb65f17c9
commit 10a2535c96
12 changed files with 225 additions and 204 deletions

View File

@@ -7,7 +7,7 @@ EvaluationScope::EvaluationScope(unordered_map<size_t, shared_ptr<EvalValue>> *s
_localScope = unordered_map<uint64_t, shared_ptr<EvalValue>>(localVariableCount);
}
void EvaluationScope::CreateVariable(BoundVariableKey* key, const shared_ptr<EvalValue> &value) {
void EvaluationScope::CreateVariable(const BoundVariableKey* key, const shared_ptr<EvalValue> &value) {
if (key->GetScopeId() == 0){
_scriptScope -> at(key->GetIdentifier()) = value;
} else{
@@ -18,7 +18,7 @@ void EvaluationScope::CreateVariable(BoundVariableKey* key, const shared_ptr<Eva
}
}
void EvaluationScope::SetVariable(BoundVariableKey* key, const shared_ptr<EvalValue> &value) {
void EvaluationScope::SetVariable(const BoundVariableKey* key, const shared_ptr<EvalValue> &value) {
if (key->GetScopeId() == 0){
_scriptScope -> at(key->GetIdentifier()) = value;
} else{
@@ -26,7 +26,7 @@ void EvaluationScope::SetVariable(BoundVariableKey* key, const shared_ptr<EvalVa
}
}
shared_ptr<EvalValue> EvaluationScope::GetVariable(BoundVariableKey* key) {
shared_ptr<EvalValue> EvaluationScope::GetVariable(const BoundVariableKey* key) {
if (key->GetScopeId() == 0){
return _scriptScope -> at(key->GetIdentifier());
} else{

View File

@@ -13,9 +13,9 @@ public:
explicit EvaluationScope(unordered_map<size_t, shared_ptr<EvalValue>>* scriptVariables, int deepestScope);
~EvaluationScope() = default;
void CreateVariable(BoundVariableKey* key, const shared_ptr<EvalValue>& value);
void SetVariable(BoundVariableKey* key, const shared_ptr<EvalValue>& value);
shared_ptr<EvalValue> GetVariable(BoundVariableKey* key);
void CreateVariable(const BoundVariableKey* key, const shared_ptr<EvalValue>& value);
void SetVariable(const BoundVariableKey* key, const shared_ptr<EvalValue>& value);
shared_ptr<EvalValue> GetVariable(const BoundVariableKey* key);
};