class SyntaxTree::ArgParen
def trailing_comma?
def trailing_comma? arguments = self.arguments return false unless arguments.is_a?(Args) parts = arguments.parts if parts.last.is_a?(ArgBlock) # If the last argument is a block, then we can't put a trailing comma # after it without resulting in a syntax error. false elsif (parts.length == 1) && (part = parts.first) && (part.is_a?(Command) || part.is_a?(CommandCall)) # If the only argument is a command or command call, then a trailing # comma would be parsed as part of that expression instead of on this # one, so we don't want to add a trailing comma. false else # Otherwise, we should be okay to add a trailing comma. true end end