Skip to content

Commit

Permalink
break for loops when p.abort
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 16, 2024
1 parent 945f962 commit 0d771a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions compiler/parser/expr.v
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fn (mut p Parser) parse_match_expr() ast.Expr {
} else {
for {
cases << p.parse_expr()
if !p.accept(.comma) {
if !p.accept(.comma) || p.should_abort() {
break
}
}
Expand All @@ -371,7 +371,7 @@ fn (mut p Parser) parse_match_expr() ast.Expr {
cases: cases
expr: branch_expr
}
if !p.accept(.comma) {
if !p.accept(.comma) || p.should_abort() {
break
}
}
Expand Down Expand Up @@ -408,7 +408,7 @@ fn (mut p Parser) parse_if_expr() ast.Expr {
if expect_comma && p.next_tok.kind == .kw_else {
p.expect(.comma)
}
if p.tok.kind != .kw_else {
if p.tok.kind != .kw_else || p.should_abort() {
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/tags.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn (mut p Parser) parse_tags() ast.Tags {
}
arg_value := p.parse_expr()
args << ast.TagArg{arg_name, arg_value}
if !p.accept(.comma) {
if !p.accept(.comma) || p.should_abort() {
break
}
}
Expand Down

0 comments on commit 0d771a5

Please sign in to comment.