Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c8fe73b

Browse files
committed
Allow When nodes to grab trailing comments away from their statements lists.
1 parent 48e3866 commit c8fe73b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
4141
- Ensure trailing comments on parameter declarations are consistent.
4242
- Make `Command` and `CommandCall` aware that their arguments could exceed their normal expected bounds because of heredocs.
4343
- Only unescape forward slashes in regular expressions if converting from slash bounds to `%r` bounds.
44+
- Allow `When` nodes to grab trailing comments away from their statements lists.
4445

4546
### Removed
4647

lib/syntax_tree.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12759,7 +12759,10 @@ def on_when(arguments, statements, consequent)
1275912759
beginning = find_token(Kw, "when")
1276012760
ending = consequent || find_token(Kw, "end")
1276112761

12762-
statements.bind(arguments.location.end_char, ending.location.start_char)
12762+
statements.bind(
12763+
find_next_statement_start(arguments.location.end_char),
12764+
ending.location.start_char
12765+
)
1276312766

1276412767
When.new(
1276512768
arguments: arguments,

0 commit comments

Comments
 (0)