From afbabd6c9e844ca5e9e40e104a054e5b0fcf9523 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Tue, 15 Jul 2025 01:11:46 +0200 Subject: [PATCH] added check for corner case --- src/parser/parser.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index c5e3568..f42a12c 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -262,18 +262,24 @@ namespace parser { if (next.type == token::type::RPAREN) break; if (!expect_next(token::type::COMMA)) { - // delete ret; + delete ret; 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)) { - // delete ret; + delete ret; return nullptr; } if (!expect_next(token::type::LBRACE)) { - // delete ret; + delete ret; return nullptr; } ret->block = parse_block();