From eeacc768a533beecb3860d4a2c9fb4bd0f63cce6 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 24 May 2022 14:27:41 -0700 Subject: [PATCH] remove unused var 'slevels' --- lib/Perl/Tidy/Debugger.pm | 1 - lib/Perl/Tidy/Formatter.pm | 1 - lib/Perl/Tidy/Tokenizer.pm | 18 +++++++----------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 40cfd348..3c4e068a 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -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}; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ff76fc0e..e54a2ddc 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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; diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 9f364870..74a00d85 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -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; -- 2.39.5