File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
5555- Properly handle trailing operators in call chains with attached comments.
5656- Force using braces if the block is within the predicate of a ternary.
5757- Properly handle trailing comments after a ` then ` operator on a ` When ` or ` In ` clause.
58+ - Ensure nested ` HshPtn ` nodes use braces.
5859
5960### Removed
6061
Original file line number Diff line number Diff line change @@ -1597,7 +1597,7 @@ def format(q)
15971597 end
15981598
15991599 parent = q . parent
1600- if parts . length == 1 || PATTERNS . any? { | pattern | parent . is_a? ( pattern ) }
1600+ if parts . length == 1 || PATTERNS . include? ( parent . class )
16011601 q . text ( "[" )
16021602 q . seplist ( parts ) { |part | q . format ( part ) }
16031603 q . text ( "]" )
@@ -6382,6 +6382,12 @@ def initialize(key, value)
63826382 @value = value
63836383 end
63846384
6385+ # This is here so that when checking if its contained within a parent
6386+ # pattern that it will return true.
6387+ def class
6388+ HshPtn
6389+ end
6390+
63856391 def comments
63866392 [ ]
63876393 end
@@ -6456,7 +6462,7 @@ def format(q)
64566462 end
64576463
64586464 parent = q . parent
6459- if PATTERNS . any? { | pattern | parent . is_a? ( pattern ) }
6465+ if PATTERNS . include? ( parent . class )
64606466 q . text ( "{ " )
64616467 contents . call
64626468 q . text ( " }" )
You can’t perform that action at this time.
0 commit comments