@@ -621,11 +621,11 @@ def trailing_comma?
621621 return false unless arguments . is_a? ( Args )
622622 parts = arguments . parts
623623
624- if parts . last & .is_a? ( ArgBlock )
624+ if parts . last . is_a? ( ArgBlock )
625625 # If the last argument is a block, then we can't put a trailing comma
626626 # after it without resulting in a syntax error.
627627 false
628- elsif parts . length == 1 && ( part = parts . first ) &&
628+ elsif ( parts . length == 1 ) && ( part = parts . first ) &&
629629 ( part . is_a? ( Command ) || part . is_a? ( CommandCall ) )
630630 # If the only argument is a command or command call, then a trailing
631631 # comma would be parsed as part of that expression instead of on this
@@ -891,6 +891,7 @@ def format(q)
891891 #
892892 # provided the line length was hit between `bar` and `baz`.
893893 class VarRefsFormatter
894+ # The separator for the fill algorithm.
894895 class Separator
895896 def call ( q )
896897 q . text ( "," )
@@ -2522,7 +2523,8 @@ def format_chain(q, children)
25222523 # https://github.com/prettier/plugin-ruby/issues/862.
25232524 else
25242525 # If we're at a Call node and not a MethodAddBlock node in the
2525- # chain then we're going to add a newline so it indents properly.
2526+ # chain then we're going to add a newline so it indents
2527+ # properly.
25262528 q . breakable_empty
25272529 end
25282530 end
@@ -2701,15 +2703,15 @@ def format(q)
27012703 end
27022704 end
27032705
2706+ # Print out the arguments to this call. If there are no arguments, then do
2707+ #nothing.
27042708 def format_arguments ( q )
27052709 case arguments
27062710 when ArgParen
27072711 q . format ( arguments )
27082712 when Args
27092713 q . text ( " " )
27102714 q . format ( arguments )
2711- else
2712- # Do nothing if there are no arguments.
27132715 end
27142716 end
27152717
@@ -3180,6 +3182,8 @@ def format(q)
31803182 end
31813183 end
31823184
3185+ # Format the arguments for this command call here. If there are no
3186+ # arguments, then print nothing.
31833187 if arguments
31843188 parts = arguments . parts
31853189
@@ -3190,8 +3194,6 @@ def format(q)
31903194 q . text ( " " )
31913195 q . nest ( argument_alignment ( q , doc ) ) { q . format ( arguments ) }
31923196 end
3193- else
3194- # If there are no arguments, print nothing.
31953197 end
31963198 end
31973199 end
0 commit comments