Skip to content

Commit

Permalink
Add missing locations to When nodes (#15481)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija authored Feb 22, 2025
1 parent c29083a commit 852d6cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,9 @@ module Crystal

when_body = parse_expressions
skip_space_or_newline
whens << When.new(when_conds, when_body).at(location)
whens << When.new(when_conds, when_body)
.at(location)
.at_end(when_conds.last.end_location)
when Keyword::ELSE
if exhaustive
raise "exhaustive case (case ... in) doesn't allow an 'else'"
Expand Down Expand Up @@ -2990,6 +2992,8 @@ module Crystal
skip_space_or_newline

whens << When.new(condition, body)
.at(location)
.at_end(condition.end_location)
when Keyword::ELSE
if whens.size == 0
unexpected_token "expecting when"
Expand Down

0 comments on commit 852d6cc

Please sign in to comment.