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

Commit 391bf14

Browse files
committed
Make Command and CommandCall aware that their arguments could exceed their normal expected bounds because of heredocs.
1 parent b63b1b3 commit 391bf14

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
3939
- Check that a block is within the predicate in a more relaxed way.
4040
- Ensure the `Return` breaks with brackets and not parentheses.
4141
- Ensure trailing comments on parameter declarations are consistent.
42+
- Make `Command` and `CommandCall` aware that their arguments could exceed their normal expected bounds because of heredocs.
4243

4344
### Removed
4445

lib/syntax_tree.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3577,7 +3577,13 @@ def on_command(message, arguments)
35773577
Command.new(
35783578
message: message,
35793579
arguments: arguments,
3580-
location: message.location.to(arguments.location)
3580+
location:
3581+
Location.new(
3582+
start_line: message.location.start_line,
3583+
start_char: message.location.start_char,
3584+
end_line: [message.location.end_line, arguments.location.end_line].max,
3585+
end_char: arguments.location.end_char
3586+
)
35813587
)
35823588
end
35833589

@@ -3724,7 +3730,13 @@ def on_command_call(receiver, operator, message, arguments)
37243730
operator: operator,
37253731
message: message,
37263732
arguments: arguments,
3727-
location: receiver.location.to(ending.location)
3733+
location:
3734+
Location.new(
3735+
start_line: receiver.location.start_line,
3736+
start_char: receiver.location.start_char,
3737+
end_line: [receiver.location.end_line, ending.location.end_line].max,
3738+
end_char: ending.location.end_char
3739+
)
37283740
)
37293741
end
37303742

0 commit comments

Comments
 (0)