Handling for when userdata is not defined yet, but might be defined later
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:
@@ -29,6 +29,8 @@ namespace Porygon::Parser {
|
||||
|
||||
inline const Token *Parser::Next() {
|
||||
this->_position++;
|
||||
if (_position > _tokens.size())
|
||||
return nullptr;
|
||||
return this->_tokens[_position - 1];
|
||||
}
|
||||
|
||||
@@ -183,11 +185,14 @@ namespace Porygon::Parser {
|
||||
auto block = this->ParseBlock({TokenKind::EndKeyword});
|
||||
|
||||
auto start = current->GetStartPosition();
|
||||
auto end = block->GetEndPosition();
|
||||
if (hasErrors) {
|
||||
return new ParsedBadStatement(start, block->GetEndPosition() - start);
|
||||
delete block;
|
||||
return new ParsedBadStatement(start, end - start);
|
||||
}
|
||||
if (block->GetKind() == ParsedStatementKind::Bad) {
|
||||
return new ParsedBadStatement(start, block->GetEndPosition() - start);
|
||||
delete block;
|
||||
return new ParsedBadStatement(start, end - start);
|
||||
}
|
||||
auto functionIdentifier = dynamic_cast<const IdentifierToken*>(functionIdentifierToken)->GetValue();
|
||||
return new ParsedFunctionDeclarationStatement(HashedString(functionIdentifier), parameters,
|
||||
|
||||
Reference in New Issue
Block a user