Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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