Skip to content

Commit a12a74a

Browse files
committed
Handle empty and single element Arrays
1 parent aeee4d0 commit a12a74a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/syntax_tree/node.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,11 @@ def format(q)
20762076
end
20772077
elsif part.is_a?(ArrayLiteral)
20782078
q.text(" ")
2079-
q.format(part.contents)
2079+
if part.contents && part.contents.parts.length > 1
2080+
q.format(part.contents)
2081+
else
2082+
q.format(arguments)
2083+
end
20802084
else
20812085
format_arguments(q, "(", ")")
20822086
end

0 commit comments

Comments
 (0)