Implements return statement
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:
@@ -15,7 +15,8 @@
|
||||
using namespace std;
|
||||
|
||||
class Evaluator {
|
||||
shared_ptr<EvalValue> _result;
|
||||
shared_ptr<EvalValue> _returnValue;
|
||||
bool _hasReturned;
|
||||
shared_ptr<EvalValue> _lastValue;
|
||||
|
||||
Script* _scriptData;
|
||||
@@ -26,6 +27,7 @@ class Evaluator {
|
||||
void EvaluateExpressionStatement(BoundExpressionStatement* statement);
|
||||
void EvaluateAssignmentStatement(BoundAssignmentStatement* statement);
|
||||
void EvaluateFunctionDeclarationStatement(BoundFunctionDeclarationStatement *statement);
|
||||
void EvaluateReturnStatement(BoundReturnStatement *statement);
|
||||
|
||||
shared_ptr<EvalValue> EvaluateExpression(BoundExpression* expression);
|
||||
shared_ptr<NumericEvalValue> EvaluateIntegerExpression(BoundExpression* expression);
|
||||
@@ -47,6 +49,8 @@ class Evaluator {
|
||||
public:
|
||||
explicit Evaluator(Script* script){
|
||||
_scriptData = script;
|
||||
_hasReturned = false;
|
||||
_returnValue = nullptr;
|
||||
_evaluationScope = nullptr;
|
||||
}
|
||||
|
||||
@@ -55,7 +59,7 @@ public:
|
||||
}
|
||||
|
||||
void Evaluate(BoundScriptStatement* statement);
|
||||
EvalValue* EvaluateFunction(ScriptFunctionEvalValue* func, vector<EvalValue*> parameters);
|
||||
shared_ptr<EvalValue> EvaluateFunction(ScriptFunctionEvalValue* func, vector<EvalValue*> parameters);
|
||||
|
||||
EvalValue* GetLastValue(){
|
||||
return _lastValue.get();
|
||||
|
||||
Reference in New Issue
Block a user