General cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-07-04 18:24:49 +02:00
parent 0446c1098b
commit bb0a6aba19
20 changed files with 90 additions and 92 deletions

View File

@@ -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());
}
}

View File

@@ -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);