Skip to content

Commit

Permalink
avoid infinite loop inside p.parse_primary_expr()
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 26, 2024
1 parent ea3f3ec commit 249d016
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion compiler/parser/expr.v
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ fn (mut p Parser) parse_primary_expr() ast.Expr {
else {}
}

for true {
if p.should_abort() {
return expr
}

for {
match true {
p.accept(.lparen) {
// call expr
Expand Down Expand Up @@ -289,6 +293,9 @@ fn (mut p Parser) parse_primary_expr() ast.Expr {
right: p.parse_expr()
}
}
p.should_abort() {
break
}
else {
break
}
Expand Down

0 comments on commit 249d016

Please sign in to comment.