]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix c090, inconsistent warning messages for deprecated syntax
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 21 Oct 2021 13:21:02 +0000 (06:21 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 21 Oct 2021 13:21:02 +0000 (06:21 -0700)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index d88b510a353030ba8998e090272c461421b3867c..c7a323641b148334a2589e93b16b16aef92a7b9a 100644 (file)
@@ -3628,20 +3628,23 @@ EOM
                     }
                 }
 
-                $last_last_nonblank_token      = $last_nonblank_token;
-                $last_last_nonblank_type       = $last_nonblank_type;
-                $last_last_nonblank_block_type = $last_nonblank_block_type;
-                $last_last_nonblank_container_type =
-                  $last_nonblank_container_type;
-                $last_last_nonblank_type_sequence =
-                  $last_nonblank_type_sequence;
-                $last_nonblank_token          = $tok;
-                $last_nonblank_type           = $type;
-                $last_nonblank_prototype      = $prototype;
-                $last_nonblank_block_type     = $block_type;
-                $last_nonblank_container_type = $container_type;
-                $last_nonblank_type_sequence  = $type_sequence;
-                $last_nonblank_i              = $i_tok;
+                # fix c090, only rotate vars if a new token will be stored
+                if ( $i_tok >= 0 ) {
+                    $last_last_nonblank_token      = $last_nonblank_token;
+                    $last_last_nonblank_type       = $last_nonblank_type;
+                    $last_last_nonblank_block_type = $last_nonblank_block_type;
+                    $last_last_nonblank_container_type =
+                      $last_nonblank_container_type;
+                    $last_last_nonblank_type_sequence =
+                      $last_nonblank_type_sequence;
+                    $last_nonblank_token          = $tok;
+                    $last_nonblank_type           = $type;
+                    $last_nonblank_prototype      = $prototype;
+                    $last_nonblank_block_type     = $block_type;
+                    $last_nonblank_container_type = $container_type;
+                    $last_nonblank_type_sequence  = $type_sequence;
+                    $last_nonblank_i              = $i_tok;
+                }
 
                 # Patch for c030: Fix things in case a '->' got separated from
                 # the subsequent identifier by a side comment.  We need the
index 39d9b99ba9d2f226e02cdc7b4b01b2a2c74c4d4b..3ec02ca68c4d4ee9d75b2e7203349ea7ed473146 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<Fix c090, inconsistent warning messages for deprecated syntax>
+
+For something like the following snippet, a warning about deprecated syntax was
+either going into the error file or the log file, depending on formatting.
+This has been fixed.
+
+   do $roff ( &verify($tpage) );
+
+20 Oct 2021.
+
 =item B<Fix c091, incorrect closing side comment>
 
 An error was discovered and corrected in the behavior of the --closing-side-comment