Removed LastValue variable, as it can be better emulated with basic return values

This commit is contained in:
2019-07-27 10:51:24 +02:00
parent 8b80b5789d
commit 268f6b59fb
10 changed files with 111 additions and 161 deletions

View File

@@ -30,7 +30,7 @@ Porygon::Script::Script(const u16string& s)
this -> Parse(s);
}
const EvalValue* Porygon::Script::Evaluate() {
shared_ptr<const EvalValue> Porygon::Script::Evaluate() {
return _evaluator->Evaluate(_boundScript.get());
}
@@ -71,9 +71,9 @@ bool Porygon::Script::HasVariable(const u16string &key) {
return f != _scriptVariables->end();
}
const EvalValue *Porygon::Script::GetLastValue() {
/*const EvalValue *Porygon::Script::GetLastValue() {
return _evaluator->GetLastValue();
}
}*/
bool Porygon::Script::HasFunction(const u16string &key) {
auto f = _scriptVariables->find(HashedString::CreateLookup(key));
@@ -109,12 +109,10 @@ extern "C" {
return Porygon::Script::Create(s);
}
void EvaluateScript(Porygon::Script* script){
script->Evaluate();
}
const EvalValue* GetLastValue(Porygon::Script* script){
return script->GetLastValue();
const EvalValue* EvaluateScript(Porygon::Script* script){
auto result = script -> Evaluate();
auto resultPtr = result.get();
return resultPtr;
}
bool HasVariable(Porygon::Script* script, const char16_t* key){