Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Format correctly for chained call nodes with arguments
  • Loading branch information
kddnewton committed Apr 22, 2022
commit b7c02329b10e95073d8a559f74507cddcf202b1f
10 changes: 9 additions & 1 deletion lib/syntax_tree/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2297,7 +2297,15 @@ def format(q)
q.format(message) if message != :call
end

q.format(arguments) if arguments
case arguments
in ArgParen
q.format(arguments)
in Args
q.text(" ")
q.format(arguments)
else
# Do nothing if there are no arguments.
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/syntax_tree/prettyprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ def if_break
# to build the break contents.
def if_flat
doc = IfBreak.new
target << doc

with_target(doc.flat_contents) { yield }
end
Expand Down