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

Commit 2d9d555

Browse files
committed
Format correctly for chained call nodes with arguments
1 parent c3c204d commit 2d9d555

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/syntax_tree/node.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,15 @@ def format(q)
22902290
q.format(message) if message != :call
22912291
end
22922292

2293-
q.format(arguments) if arguments
2293+
case arguments
2294+
in ArgParen
2295+
q.format(arguments)
2296+
in Args
2297+
q.text(" ")
2298+
q.format(arguments)
2299+
else
2300+
# Do nothing if there are no arguments.
2301+
end
22942302
end
22952303
end
22962304
end

lib/syntax_tree/prettyprint.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ def if_break
10201020
# to build the break contents.
10211021
def if_flat
10221022
doc = IfBreak.new
1023+
target << doc
10231024

10241025
with_target(doc.flat_contents) { yield }
10251026
end

0 commit comments

Comments
 (0)