]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix -bom to filter non-method calls; c426
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 7 Dec 2024 00:09:47 +0000 (16:09 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 7 Dec 2024 00:09:47 +0000 (16:09 -0800)
lib/Perl/Tidy/Formatter.pm

index 3394670396804ea3d9dee61a0ed7968693116ec3..d9877b1a8abe5fabbd2b9dd766bdc3f6925e66ef 100644 (file)
@@ -18955,6 +18955,12 @@ sub keep_old_line_breaks {
                 next if ( !defined($Kp) );
                 next if ( $is_opening_type{ $rLL->[$Kp]->[_TYPE_] } );
 
+                # ignore -bom if this does not look like a method call; c426
+                my $Kn = $self->K_next_nonblank($Kfirst);
+                next if ( !defined($Kn) );
+                my $token_n = $rLL->[$Kn]->[_TYPE_];
+                next if ( $token_n eq '{' || $token_n eq '[' );
+
                 $rbreak_before_Kfirst->{$Kfirst} = 2;
             }
 
@@ -18980,6 +18986,12 @@ sub keep_old_line_breaks {
                 # opens the opening paren when the closing paren opens.
                 # Relevant cases are b977, b1215, b1270, b1303
 
+                # ignore -bom if this does not look like a method call; c426
+                $Kn = $self->K_next_nonblank($Kn);
+                next if ( !defined($Kn) );
+                my $token_n = $rLL->[$Kn]->[_TYPE_];
+                next if ( $token_n eq '{' || $token_n eq '[' );
+
                 $rbreak_container->{$seqno} = 1;
             }
             else {