added check for corner case

This commit is contained in:
Karma Riuk
2025-07-15 01:11:46 +02:00
parent 057d6fc9f1
commit afbabd6c9e

View File

@@ -262,18 +262,24 @@ namespace parser {
if (next.type == token::type::RPAREN) if (next.type == token::type::RPAREN)
break; break;
if (!expect_next(token::type::COMMA)) { if (!expect_next(token::type::COMMA)) {
// delete ret; delete ret;
return nullptr; return nullptr;
} }
} }
if (current.type == token::type::COMMA
&& next.type == token::type::RPAREN) {
next_error(token::type::IDENTIFIER);
delete ret;
return nullptr;
}
if (!expect_next(token::type::RPAREN)) { if (!expect_next(token::type::RPAREN)) {
// delete ret; delete ret;
return nullptr; return nullptr;
} }
if (!expect_next(token::type::LBRACE)) { if (!expect_next(token::type::LBRACE)) {
// delete ret; delete ret;
return nullptr; return nullptr;
} }
ret->block = parse_block(); ret->block = parse_block();