remove unused var 'slevels'
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 24 May 2022 21:27:41 +0000 (14:27 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 24 May 2022 21:27:41 +0000 (14:27 -0700)
lib/Perl/Tidy/Debugger.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/Tokenizer.pm

index 40cfd348aa704ff8676581cfbcc6225fde402352..3c4e068a96cd0e68c9e23e4377107a5337cb4936 100644 (file)
@@ -67,7 +67,6 @@ sub write_debug_entry {
     my $rtoken_type = $line_of_tokens->{_rtoken_type};
     my $rtokens     = $line_of_tokens->{_rtokens};
     my $rlevels     = $line_of_tokens->{_rlevels};
-    my $rslevels    = $line_of_tokens->{_rslevels};
     my $rblock_type = $line_of_tokens->{_rblock_type};
 
     my $input_line_number = $line_of_tokens->{_line_number};
index ff76fc0e752ff541f92573e1bcdb8963c364d386..e54a2ddcf820be4968d6737487bc0896461c2f1e 100644 (file)
@@ -5322,7 +5322,6 @@ EOM
             my $rblock_type    = $line_of_tokens_old->{_rblock_type};
             my $rtype_sequence = $line_of_tokens_old->{_rtype_sequence};
             my $rlevels        = $line_of_tokens_old->{_rlevels};
-            my $rslevels       = $line_of_tokens_old->{_rslevels};
             my $rci_levels     = $line_of_tokens_old->{_rci_levels};
 
             my $jmax = @{$rtokens} - 1;
index 9f364870f8aa0c47dd60efe9785b5b5105206e7b..74a00d852ec6766b34a5f14eccdfeb6ebe38381a 100644 (file)
@@ -863,7 +863,6 @@ sub get_line {
 ##        _rtoken_type               => undef,
 ##        _rtokens                   => undef,
 ##        _rlevels                   => undef,
-##        _rslevels                  => undef,
 ##        _rblock_type               => undef,
 ##        _rcontainer_type           => undef,
 ##        _rcontainer_environment    => undef,
@@ -4544,7 +4543,6 @@ EOM
             $line_of_tokens->{_rtokens}          = [$input_line];
             $line_of_tokens->{_rtoken_type}      = ['#'];
             $line_of_tokens->{_rlevels}          = [$level_in_tokenizer];
-            $line_of_tokens->{_rslevels}         = [$slevel_in_tokenizer];
             $line_of_tokens->{_rci_levels}       = [$ci_string_i];
             $line_of_tokens->{_rblock_type}      = [EMPTY_STRING];
             $line_of_tokens->{_nesting_tokens_0} = $nesting_token_string;
@@ -4925,16 +4923,17 @@ EOM
         # the result up for shipping.  Most of the remaining work involves
         # defining the various indentation parameters that the formatter needs
         # (indentation level and continuation indentation).  This turns out to
-        # be rather complicated.
+        # be somewhat complicated.
 
-        # TODO: variable 'slevel' is no longer needed and can be removed
+        # Programming note: the old variable @slevels has been eliminated
+        # but some of the slevel coding still remains and is used in the
+        # ci calculation.  It would be nice to find a way to remove it.
 
         my @token_type    = ();    # stack of output token types
         my @block_type    = ();    # stack of output code block types
         my @type_sequence = ();    # stack of output type sequence numbers
         my @tokens        = ();    # output tokens
         my @levels        = ();    # structural brace levels of output tokens
-        my @slevels       = ();    # secondary nesting levels of output tokens
         my @ci_string = ();  # string needed to compute continuation indentation
         my $container_environment = EMPTY_STRING;
         my $im                    = -1;             # previous $i value
@@ -5012,9 +5011,6 @@ EOM
         # loop over the list of pre-tokens indexes
         foreach my $i ( @{$routput_token_list} ) {
 
-            # We store the slevel value before it is updated for this token
-            push( @slevels, $slevel_in_tokenizer );
-
             # Get $tok_i, the PRE-token.  It only equals the token for symbols
             my $tok_i  = $rtokens->[$i];
             my $type_i = $routput_token_type->[$i];
@@ -5503,8 +5499,8 @@ EOM
                 }
             }
 
-            # Store the values for this token. Note that @slevel was
-            # stored at the top of the loop and @tokens is handled below.
+            # Store the values for this token except for @tokens,
+            # which is handled specially below.
             push( @block_type,    $routput_block_type->[$i] );
             push( @ci_string,     $ci_string_i );
             push( @levels,        $level_i );
@@ -5553,6 +5549,7 @@ EOM
             push( @tokens, substr( $input_line, $rtoken_map->[$im], $num ) );
         }
 
+        # TODO: maybe move these to the end of the loop sub
         $tokenizer_self->[_in_attribute_list_] = $in_attribute_list;
         $tokenizer_self->[_in_quote_]          = $in_quote;
         $tokenizer_self->[_quote_target_] =
@@ -5564,7 +5561,6 @@ EOM
         $line_of_tokens->{_rblock_type}    = \@block_type;
         $line_of_tokens->{_rtype_sequence} = \@type_sequence;
         $line_of_tokens->{_rlevels}        = \@levels;
-        $line_of_tokens->{_rslevels}       = \@slevels;
         $line_of_tokens->{_rci_levels}     = \@ci_string;
 
         return;