More fixes for boundscope
This commit is contained in:
@@ -32,9 +32,11 @@ BoundStatement* Binder::BindStatement(ParsedStatement* statement){
|
||||
BoundStatement *Binder::BindBlockStatement(ParsedStatement *statement) {
|
||||
auto statements = ((ParsedBlockStatement*)statement)->GetStatements();
|
||||
vector<BoundStatement*> boundStatements (statements.size());
|
||||
this->_scope->GoInnerScope();
|
||||
for (int i = 0; i < statements.size(); i++){
|
||||
boundStatements[i] = this -> BindStatement(statements[i]);
|
||||
}
|
||||
this->_scope->GoOuterScope();
|
||||
return new BoundBlockStatement(boundStatements);
|
||||
}
|
||||
|
||||
@@ -48,8 +50,8 @@ BoundStatement* Binder::BindAssignmentStatement(ParsedStatement *statement){
|
||||
auto boundExpression = this->BindExpression(s->GetExpression());
|
||||
VariableAssignment assignment =
|
||||
s->IsLocal() ?
|
||||
this->_scope->CreateExplicitLocal(s->GetIdentifier().GetHash(), boundExpression->GetType())
|
||||
: this->_scope->AssignVariable(s->GetIdentifier().GetHash(), boundExpression->GetType());
|
||||
this->_scope->CreateExplicitLocal(s->GetIdentifier().GetHash(), *boundExpression->GetType())
|
||||
: this->_scope->AssignVariable(s->GetIdentifier().GetHash(), *boundExpression->GetType());
|
||||
if (assignment.GetResult() == VariableAssignmentResult::Ok){
|
||||
auto key = assignment.GetKey();
|
||||
return new BoundAssignmentStatement(key, boundExpression);
|
||||
|
||||
Reference in New Issue
Block a user