fix: detect missing closing brace in block parsing to prevent crash
The compiler previously relied on `match(TOKEN_RIGHT_BRACE)` in the while loop condition, which consumed the brace and made it impossible to detect a missing one. Changed to peek-based loop termination and added explicit `consume` call for the closing brace, ensuring proper error reporting when '}' is absent. Added regression test for issue #429.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// The missing "}" was not detected by the compiler and reported as an error,
|
||||
// so it then tried to run the resulting erroneous bytecode and crashed.
|
||||
|
||||
// expect error line 6
|
||||
{
|
||||
System
|
||||
Reference in New Issue
Block a user