@@ -2068,13 +2068,19 @@ def format(q)
2068
2068
if part . is_a? ( Paren )
2069
2069
if part . contents . body . length == 1 && skip_parens? ( part . contents . body . first )
2070
2070
q . text ( " " )
2071
- q . format ( part . contents . body . first )
2071
+ contents = part . contents . body . first
2072
+ contents = contents . contents if contents . is_a? ( ArrayLiteral )
2073
+ q . format ( contents )
2072
2074
else
2073
2075
q . format ( arguments )
2074
2076
end
2075
2077
elsif part . is_a? ( ArrayLiteral )
2076
2078
q . text ( " " )
2077
- q . format ( arguments )
2079
+ if part . contents && part . contents . parts . length > 1
2080
+ q . format ( part . contents )
2081
+ else
2082
+ q . format ( arguments )
2083
+ end
2078
2084
else
2079
2085
format_arguments ( q , "(" , ")" )
2080
2086
end
@@ -2087,6 +2093,7 @@ def format(q)
2087
2093
2088
2094
private
2089
2095
2096
+
2090
2097
def format_arguments ( q , opening , closing )
2091
2098
q . if_break { q . text ( opening ) }
2092
2099
q . indent do
@@ -2099,7 +2106,7 @@ def format_arguments(q, opening, closing)
2099
2106
2100
2107
def skip_parens? ( node )
2101
2108
case node
2102
- in Int | FloatLiteral
2109
+ in Int | FloatLiteral | ArrayLiteral
2103
2110
true
2104
2111
in VarRef [ value : GVar | IVar | CVar | Kw | Const ]
2105
2112
true
@@ -2523,7 +2530,7 @@ def child_nodes
2523
2530
end
2524
2531
2525
2532
alias deconstruct child_nodes
2526
-
2533
+
2527
2534
def deconstruct_keys ( keys )
2528
2535
{ value : value , location : location }
2529
2536
end
@@ -3808,7 +3815,7 @@ def child_nodes
3808
3815
end
3809
3816
3810
3817
alias deconstruct child_nodes
3811
-
3818
+
3812
3819
def deconstruct_keys ( keys )
3813
3820
{ value : value , location : location }
3814
3821
end
@@ -3838,7 +3845,7 @@ def child_nodes
3838
3845
end
3839
3846
3840
3847
alias deconstruct child_nodes
3841
-
3848
+
3842
3849
def deconstruct_keys ( keys )
3843
3850
{ value : value , location : location }
3844
3851
end
@@ -3870,7 +3877,7 @@ def child_nodes
3870
3877
end
3871
3878
3872
3879
alias deconstruct child_nodes
3873
-
3880
+
3874
3881
def deconstruct_keys ( keys )
3875
3882
{ value : value , location : location }
3876
3883
end
@@ -5311,7 +5318,7 @@ def child_nodes
5311
5318
end
5312
5319
5313
5320
alias deconstruct child_nodes
5314
-
5321
+
5315
5322
def deconstruct_keys ( keys )
5316
5323
{ value : value , location : location }
5317
5324
end
@@ -6436,7 +6443,7 @@ def child_nodes
6436
6443
end
6437
6444
6438
6445
alias deconstruct child_nodes
6439
-
6446
+
6440
6447
def deconstruct_keys ( keys )
6441
6448
{ value : value , location : location }
6442
6449
end
@@ -6536,7 +6543,7 @@ def child_nodes
6536
6543
end
6537
6544
6538
6545
alias deconstruct child_nodes
6539
-
6546
+
6540
6547
def deconstruct_keys ( keys )
6541
6548
{ value : value , location : location }
6542
6549
end
@@ -6597,7 +6604,7 @@ def child_nodes
6597
6604
end
6598
6605
6599
6606
alias deconstruct child_nodes
6600
-
6607
+
6601
6608
def deconstruct_keys ( keys )
6602
6609
{ value : value , location : location }
6603
6610
end
@@ -6622,7 +6629,7 @@ def child_nodes
6622
6629
end
6623
6630
6624
6631
alias deconstruct child_nodes
6625
-
6632
+
6626
6633
def deconstruct_keys ( keys )
6627
6634
{ value : value , location : location }
6628
6635
end
@@ -6693,7 +6700,7 @@ def child_nodes
6693
6700
end
6694
6701
6695
6702
alias deconstruct child_nodes
6696
-
6703
+
6697
6704
def deconstruct_keys ( keys )
6698
6705
{ beginning : beginning , parts : parts , location : location }
6699
6706
end
@@ -6726,7 +6733,7 @@ def child_nodes
6726
6733
end
6727
6734
6728
6735
alias deconstruct child_nodes
6729
-
6736
+
6730
6737
def deconstruct_keys ( keys )
6731
6738
{ value : value , location : location }
6732
6739
end
@@ -6760,7 +6767,7 @@ def child_nodes
6760
6767
end
6761
6768
6762
6769
alias deconstruct child_nodes
6763
-
6770
+
6764
6771
def deconstruct_keys ( keys )
6765
6772
{ value : value , location : location }
6766
6773
end
@@ -7246,7 +7253,7 @@ def initialize(value:, location:)
7246
7253
@value = value
7247
7254
@location = location
7248
7255
end
7249
-
7256
+
7250
7257
def accept ( visitor )
7251
7258
visitor . visit_rparen ( self )
7252
7259
end
@@ -7256,7 +7263,7 @@ def child_nodes
7256
7263
end
7257
7264
7258
7265
alias deconstruct child_nodes
7259
-
7266
+
7260
7267
def deconstruct_keys ( keys )
7261
7268
{ value : value , location : location }
7262
7269
end
@@ -7511,7 +7518,7 @@ def child_nodes
7511
7518
end
7512
7519
7513
7520
alias deconstruct child_nodes
7514
-
7521
+
7515
7522
def deconstruct_keys ( keys )
7516
7523
{ parts : parts , location : location }
7517
7524
end
@@ -7808,7 +7815,7 @@ def child_nodes
7808
7815
end
7809
7816
7810
7817
alias deconstruct child_nodes
7811
-
7818
+
7812
7819
def deconstruct_keys ( keys )
7813
7820
{ value : value , location : location }
7814
7821
end
@@ -7838,7 +7845,7 @@ def child_nodes
7838
7845
end
7839
7846
7840
7847
alias deconstruct child_nodes
7841
-
7848
+
7842
7849
def deconstruct_keys ( keys )
7843
7850
{ value : value , location : location }
7844
7851
end
@@ -7969,7 +7976,7 @@ def child_nodes
7969
7976
end
7970
7977
7971
7978
alias deconstruct child_nodes
7972
-
7979
+
7973
7980
def deconstruct_keys ( keys )
7974
7981
{ value : value , location : location }
7975
7982
end
@@ -7998,7 +8005,7 @@ def child_nodes
7998
8005
end
7999
8006
8000
8007
alias deconstruct child_nodes
8001
-
8008
+
8002
8009
def deconstruct_keys ( keys )
8003
8010
{ value : value , location : location }
8004
8011
end
@@ -8028,7 +8035,7 @@ def child_nodes
8028
8035
end
8029
8036
8030
8037
alias deconstruct child_nodes
8031
-
8038
+
8032
8039
def deconstruct_keys ( keys )
8033
8040
{ value : value , location : location }
8034
8041
end
@@ -8139,7 +8146,7 @@ def child_nodes
8139
8146
end
8140
8147
8141
8148
alias deconstruct child_nodes
8142
-
8149
+
8143
8150
def deconstruct_keys ( keys )
8144
8151
{ value : value , location : location }
8145
8152
end
@@ -8217,7 +8224,7 @@ def child_nodes
8217
8224
end
8218
8225
8219
8226
alias deconstruct child_nodes
8220
-
8227
+
8221
8228
def deconstruct_keys ( keys )
8222
8229
{ value : value , location : location }
8223
8230
end
@@ -9242,7 +9249,7 @@ def child_nodes
9242
9249
end
9243
9250
9244
9251
alias deconstruct child_nodes
9245
-
9252
+
9246
9253
def deconstruct_keys ( keys )
9247
9254
{ value : value , location : location }
9248
9255
end
@@ -9271,7 +9278,7 @@ def child_nodes
9271
9278
end
9272
9279
9273
9280
alias deconstruct child_nodes
9274
-
9281
+
9275
9282
def deconstruct_keys ( keys )
9276
9283
{ parts : parts , location : location }
9277
9284
end
0 commit comments