Implements variable assignment evaluation
This commit is contained in:
@@ -11,7 +11,7 @@ BoundScriptStatement *Binder::Bind(Script* script, ParsedScriptStatement *s, Bou
|
||||
for (int i = 0; i < statements.size(); i++){
|
||||
boundStatements[i] = binder.BindStatement(statements[i]);
|
||||
}
|
||||
return new BoundScriptStatement(boundStatements);
|
||||
return new BoundScriptStatement(boundStatements, scriptScope->GetDeepestScope());
|
||||
}
|
||||
|
||||
Binder::~Binder() {
|
||||
|
||||
@@ -54,13 +54,19 @@ public:
|
||||
};
|
||||
|
||||
class BoundScriptStatement : public BoundBlockStatement{
|
||||
int _deepestScope;
|
||||
public:
|
||||
explicit BoundScriptStatement(vector<BoundStatement*> statements) : BoundBlockStatement(std::move(statements)){
|
||||
explicit BoundScriptStatement(vector<BoundStatement*> statements, int deepestScope) : BoundBlockStatement(std::move(statements)){
|
||||
_deepestScope = deepestScope;
|
||||
}
|
||||
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Script;
|
||||
}
|
||||
|
||||
int GetDeepestScope(){
|
||||
return _deepestScope;
|
||||
}
|
||||
};
|
||||
|
||||
class BoundExpressionStatement : public BoundStatement{
|
||||
@@ -98,6 +104,14 @@ public:
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Assignment;
|
||||
}
|
||||
|
||||
BoundVariableKey* GetKey(){
|
||||
return _key;
|
||||
}
|
||||
|
||||
BoundExpression* GetExpression(){
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
|
||||
@@ -28,6 +28,10 @@ public:
|
||||
BoundVariable* GetVariable(int scope, int identifier);
|
||||
VariableAssignment CreateExplicitLocal(int identifier, const ScriptType& type);
|
||||
VariableAssignment AssignVariable(int identifier, const ScriptType& type);
|
||||
|
||||
int GetDeepestScope(){
|
||||
return _deepestScope;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user