This commit is contained in:
@@ -187,10 +187,10 @@ namespace Porygon::Binder {
|
||||
assignmentKey = assignment.GetKey();
|
||||
}
|
||||
|
||||
auto boundBlock = this->BindBlockStatement(functionStatement->GetBlock());
|
||||
auto boundBlock = dynamic_cast<BoundBlockStatement*>(this->BindBlockStatement(functionStatement->GetBlock()));
|
||||
this->_scope->GoOuterScope();
|
||||
this->_currentFunction = nullptr;
|
||||
return new BoundFunctionDeclarationStatement(type, assignmentKey, (BoundBlockStatement *) boundBlock);
|
||||
return new BoundFunctionDeclarationStatement(type, assignmentKey, boundBlock);
|
||||
}
|
||||
|
||||
BoundStatement *Binder::BindReturnStatement(const ParsedStatement *statement) {
|
||||
@@ -696,14 +696,13 @@ namespace Porygon::Binder {
|
||||
auto innerScope = new BoundScope(tableScope);
|
||||
auto currentScope = this->_scope;
|
||||
this->_scope = innerScope;
|
||||
auto block = this->BindBlockStatement(expression->GetBlock());
|
||||
auto block = dynamic_cast<BoundBlockStatement*>(this->BindBlockStatement(expression->GetBlock()));
|
||||
this->_scope = currentScope;
|
||||
|
||||
auto tableType = std::make_shared<TableScriptType>(tableScope, innerScope->GetLocalVariableCount());
|
||||
delete innerScope;
|
||||
|
||||
return new BoundTableExpression((BoundBlockStatement *) block, tableType, expression->GetStartPosition(),
|
||||
expression->GetLength());
|
||||
return new BoundTableExpression(block, tableType, expression->GetStartPosition(), expression->GetLength());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,12 @@ namespace Porygon::Binder {
|
||||
BoundExpression *BindPeriodIndexExpression(const PeriodIndexExpression *expression, bool setter);
|
||||
|
||||
public:
|
||||
Binder(){
|
||||
_scriptData = nullptr;
|
||||
_scope = nullptr;
|
||||
_currentFunction = nullptr;
|
||||
}
|
||||
|
||||
static BoundScriptStatement *
|
||||
Bind(Porygon::Script *script, const ParsedScriptStatement *s, BoundScope *scriptScope);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user