]> git.donarmstrong.com Git - perltidy.git/commitdiff
minor improvement for fix b1275
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 7 Jan 2022 15:42:03 +0000 (07:42 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 7 Jan 2022 15:42:03 +0000 (07:42 -0800)
lib/Perl/Tidy/Formatter.pm

index 838697db06f3e52a69b0f1f21891e6deb92e0c1a..2e960f659c694e47ef022feaa3f83db506f7f60a 100644 (file)
@@ -9850,25 +9850,27 @@ sub break_before_list_opening_containers {
                 }
 
                 # finally, we will call it complex if there are inner opening
-                # and closing container tokens within the outer container
-                # tokens.
+                # and closing container tokens, not parens, within the outer
+                # container tokens.
                 if ( !$is_complex ) {
-                    my $Kp     = $self->K_next_nonblank($KK);
-                    my $type_p = defined($Kp) ? $rLL->[$Kp]->[_TYPE_] : 'b';
-                    if ( $is_opening_type{$type_p} ) {
+                    my $Kp      = $self->K_next_nonblank($KK);
+                    my $token_p = defined($Kp) ? $rLL->[$Kp]->[_TOKEN_] : 'b';
+                    if ( $is_opening_token{$token_p} && $token_p ne '(' ) {
 
-                        my $Kc     = $K_closing_container->{$seqno};
-                        my $Km     = $self->K_previous_nonblank($Kc);
-                        my $type_m = defined($Km) ? $rLL->[$Km]->[_TYPE_] : 'b';
+                        my $Kc = $K_closing_container->{$seqno};
+                        my $Km = $self->K_previous_nonblank($Kc);
+                        my $token_m =
+                          defined($Km) ? $rLL->[$Km]->[_TOKEN_] : 'b';
 
                         # ignore any optional ending comma
-                        if ( $type_m eq ',' ) {
+                        if ( $token_m eq ',' ) {
                             $Km = $self->K_previous_nonblank($Km);
-                            $type_m =
-                              defined($Km) ? $rLL->[$Km]->[_TYPE_] : 'b';
+                            $token_m =
+                              defined($Km) ? $rLL->[$Km]->[_TOKEN_] : 'b';
                         }
 
-                        $is_complex ||= $is_closing_type{$type_m};
+                        $is_complex ||=
+                          $is_closing_token{$token_m} && $token_m ne ')';
                     }
                 }