Skip to content

Commit b7c0232

Browse files
committed
Format correctly for chained call nodes with arguments
1 parent e739d62 commit b7c0232

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
@@ -2297,7 +2297,15 @@ def format(q)
22972297
q.format(message) if message != :call
22982298
end
22992299

2300-
q.format(arguments) if arguments
2300+
case arguments
2301+
in ArgParen
2302+
q.format(arguments)
2303+
in Args
2304+
q.text(" ")
2305+
q.format(arguments)
2306+
else
2307+
# Do nothing if there are no arguments.
2308+
end
23012309
end
23022310
end
23032311
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)