Don't parse expression on different line from return keyword
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:
@@ -172,10 +172,13 @@ namespace Porygon::Binder {
|
||||
} else {
|
||||
currentReturnType = this->_currentFunction->GetReturnType();
|
||||
}
|
||||
if (expression == nullptr && currentReturnType != nullptr) {
|
||||
if (expression == nullptr && (currentReturnType != nullptr && currentReturnType -> GetClass() != TypeClass::Nil)) {
|
||||
this->_scriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::InvalidReturnType, statement->GetStartPosition(),
|
||||
statement->GetLength());
|
||||
return new BoundBadStatement();
|
||||
} else if (expression == nullptr){
|
||||
currentReturnType = make_shared<ScriptType>(TypeClass::Nil);
|
||||
return new BoundReturnStatement(nullptr);
|
||||
}
|
||||
auto boundExpression = this->BindExpression(expression);
|
||||
auto expresionType = boundExpression->GetType();
|
||||
|
||||
Reference in New Issue
Block a user