]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1464
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 15 Jan 2024 15:23:36 +0000 (07:23 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 15 Jan 2024 15:23:36 +0000 (07:23 -0800)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index 3cc9d388c1ad09e853011dc2d996caaa15f26442..31a9c41e138a40dc1033cb658c0eda354f27aafe 100644 (file)
@@ -11881,6 +11881,24 @@ die sprintf(
 --delete-old-whitespace
 --opening-paren-right
 
+==> b1464.in <==
+while (
+    $^O !~ /Win32/ and
+
+    my $pid = fork()
+) {
+    my $status = waitpid $pid, 0;
+    warn "Server restarting in $config->{delay} seconds";
+    sleep $config->{delay};
+}
+
+==> b1464.par <==
+--opening-brace-always-on-right
+--keep-old-blank-lines=0
+--break-after-all-operators
+--keyword-group-blanks-size='2.8'
+--keyword-group-blanks-before=2
+
 ==> b148.in <==
 # state 1
 @yydgoto=(
index d7b3327b35edbf536f3287b230b0dd6827a06530..7e18b398e4050b9bc9f7946f17327177d5824461 100644 (file)
@@ -8039,6 +8039,14 @@ die sprintf(
 
 );
 
+==> b1464 <==
+while ( $^O !~ /Win32/ and
+    my $pid = fork() ) {
+    my $status = waitpid $pid, 0;
+    warn "Server restarting in $config->{delay} seconds";
+    sleep $config->{delay};
+}
+
 ==> b148 <==
 # state 1
 @yydgoto=(
index 85900d2f687f61de4163e18a2cb2fa495b5cb4f4..2dda478b1a730517839505863644576781feabee 100644 (file)
@@ -12576,6 +12576,20 @@ sub is_in_block_by_i {
     return;
 } ## end sub is_in_block_by_i
 
+sub is_in_block_by_K {
+    my ( $self, $KK ) = @_;
+
+    # returns true if
+    #     token at $KK is contained in a BLOCK
+    #     or is at root level
+    #     or there is some kind of error (i.e. unbalanced file)
+    # returns false otherwise
+
+    my $parent_seqno = $self->parent_seqno_by_K($KK);
+    return SEQ_ROOT if ( !$parent_seqno || $parent_seqno eq SEQ_ROOT );
+    return $self->[_rblock_type_of_seqno_]->{$parent_seqno};
+} ## end sub is_in_block_by_K
+
 sub is_in_list_by_i {
     my ( $self, $i ) = @_;
 
@@ -12590,16 +12604,6 @@ sub is_in_list_by_i {
     return;
 } ## end sub is_in_list_by_i
 
-sub is_list_by_K {
-
-    # Return true if token K is in a list
-    my ( $self, $KK ) = @_;
-
-    my $parent_seqno = $self->parent_seqno_by_K($KK);
-    return unless defined($parent_seqno);
-    return $self->[_ris_list_by_seqno_]->{$parent_seqno};
-} ## end sub is_list_by_K
-
 sub is_list_by_seqno {
 
     # Return true if the immediate contents of a container appears to be a
@@ -17500,7 +17504,8 @@ EOM
 
             # Do not look for keywords in lists ( keyword 'my' can occur in
             # lists, see case b760); fixed for c048.
-            if ( $self->is_list_by_K($K_first) ) {
+            # Switch from ->is_list_by_K to !->is_in_block_by_K to fix b1464
+            if ( !$self->is_in_block_by_K($K_first) ) {
                 if ( $ibeg >= 0 ) { $iend = $i }
                 next;
             }