Fixed return followed by end keyword log an error
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
12c55a12ba
commit
e75d13f509
|
@ -128,7 +128,7 @@ namespace Porygon::Parser {
|
|||
return new ParsedBlockStatement(statements, start);
|
||||
}
|
||||
auto end = 0;
|
||||
if (statements.size() > 0){
|
||||
if (!statements.empty()){
|
||||
end = statements.back()->GetEndPosition();
|
||||
}
|
||||
return new ParsedBlockStatement(statements, start, end - start);
|
||||
|
@ -214,7 +214,11 @@ namespace Porygon::Parser {
|
|||
if (startLine != this -> ScriptData -> Diagnostics -> GetLineFromPosition(this -> Peek() -> GetStartPosition())){
|
||||
return new ParsedReturnStatement(nullptr, start, current->GetLength());
|
||||
}
|
||||
auto expression = this->ParseExpression(this->Next());
|
||||
auto n = this->Peek()->GetKind();
|
||||
ParsedExpression* expression = nullptr;
|
||||
if (n != TokenKind::EndKeyword &&
|
||||
n != TokenKind::EndOfFile)
|
||||
expression = this->ParseExpression(this->Next());
|
||||
return new ParsedReturnStatement(expression, start, expression->GetEndPosition() - start);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue