Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b63b1b3

Browse files
committed
Ensure trailing comments on parameter declarations are consistent.
1 parent d9810d5 commit b63b1b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
3838
- Explicitly handle `?"` so that it formats properly.
3939
- Check that a block is within the predicate in a more relaxed way.
4040
- Ensure the `Return` breaks with brackets and not parentheses.
41+
- Ensure trailing comments on parameter declarations are consistent.
4142

4243
### Removed
4344

lib/syntax_tree.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8754,10 +8754,12 @@ def format(q)
87548754
parts << KeywordRestFormatter.new(keyword_rest) if keyword_rest
87558755
parts << block if block
87568756

8757-
q.nest(0) do
8757+
contents = -> {
87588758
q.seplist(parts) { |part| q.format(part) }
87598759
q.format(rest) if rest && rest.is_a?(ExcessedComma)
8760-
end
8760+
}
8761+
8762+
q.parent.is_a?(Paren) ? q.nest(0, &contents) : q.group(&contents)
87618763
end
87628764

87638765
def pretty_print(q)

0 commit comments

Comments
 (0)