Better error reporting for unary decrement/increment operators

There was a missing routing for those operators in parse_stmt
function.
This commit is contained in:
Krzesimir Nowak
2026-05-03 15:47:16 +02:00
parent 7788ca0242
commit 34b198019f
2 changed files with 5 additions and 2 deletions

View File

@@ -1390,7 +1390,7 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
.Pointer,
.Asm, // Inline assembly
// Unary Expressions
.Add, .Sub, .Xor, .Not, .And:
.Add, .Sub, .Xor, .Not, .And, .Increment, .Decrement:
s := parse_simple_stmt(p, {Stmt_Allow_Flag.Label})
expect_semicolon(p, s)

View File

@@ -5393,7 +5393,10 @@ gb_internal Ast *parse_stmt(AstFile *f) {
case Token_Xor:
case Token_Not:
case Token_And:
case Token_Mul: // Used for error handling when people do C-like things
// Used for error handling when people do C-like things
case Token_Mul:
case Token_Increment:
case Token_Decrement:
s = parse_simple_stmt(f, StmtAllowFlag_Label);
expect_semicolon(f);
return s;