From d0c12f9343f5d23dd6c212370a1fd49d80ffd7d3 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 20 Feb 2023 15:56:12 -0800 Subject: [PATCH] remove unused vars I found these with a utility I wrote to scan for unused vars. Most are remnants from debugging, or variables that might have been useful but were not actually used. I left a few unused hashes in the tokenizer which might be useful in the future. --- lib/Perl/Tidy.pm | 2 -- lib/Perl/Tidy/Formatter.pm | 4 ---- lib/Perl/Tidy/Logger.pm | 1 - lib/Perl/Tidy/Tokenizer.pm | 5 +---- lib/Perl/Tidy/VerticalAligner.pm | 4 ---- 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 57b034b0..f9eb5822 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -2922,7 +2922,6 @@ sub compare_string_buffers { $last_nonblank_line = $truncate->( $last_nonblank_line, 72 ); if ($last_nonblank_line) { - my $countm = $counti - 1; $msg .= <[_K_closing_container_]; my @package_list; my @package_sweep; - my $lx_max = $rLL->[$Klimit]->[_LINE_INDEX_]; foreach my $KK ( 0 .. $Klimit ) { my $item = $rLL->[$KK]; my $type = $item->[_TYPE_]; @@ -11888,7 +11887,6 @@ sub break_before_list_opening_containers { next unless ( $is_list || $has_list && $has_list == 1 ); - my $has_broken_list = $rhas_broken_list->{$seqno}; my $has_list_with_lec = $rhas_broken_list_with_lec->{$seqno}; # Only for types of container tokens with a non-default break option @@ -16829,7 +16827,6 @@ EOM # Loop over the batch to initialize some batch variables #------------------------------------------------------- my $comma_count_in_batch = 0; - my $ilast_nonblank = -1; my @colon_list; my @ix_seqno_controlling_ci; my %comma_arrow_count; @@ -19365,7 +19362,6 @@ EOM my $summed_len_2 = $summed_lengths_to_go[ $iend_2 + 1 ] - $summed_lengths_to_go[$ibeg_2]; my $iend_1_minus = max( $ibeg_1, iprev_to_go($iend_1) ); - my $ibeg_2_plus = min( $iend_2, $inext_to_go[$iend_2] ); return unless ( diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 43617e23..e8d47e81 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -462,7 +462,6 @@ sub finish { my ($self) = @_; my $warning_count = $self->{_warning_count}; - my $saw_code_bug = $self->{_saw_code_bug}; my $save_logfile = $self->{_save_logfile}; my $log_file = $self->{_log_file}; diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 0d45e745..a48495f8 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -1162,7 +1162,6 @@ sub get_line { # _in_skipped_ # _in_pod_ # _in_quote_ - my $ending_in_quote_last = $self->[_in_quote_]; $self->tokenize_this_line($line_of_tokens); # Now finish defining the return structure and return it @@ -6379,7 +6378,7 @@ sub decide_if_code_block { foreach my $k ( $j + 1 .. @pre_types - 2 ) { if ( $pre_types[$k] eq $quote_mark ) { $j = $k + 1; - my $next = $pre_types[$j]; + ##my $next = $pre_types[$j]; last; } } @@ -9490,8 +9489,6 @@ sub do_quote { ) = @_; - my $in_quote_starting = $in_quote; - my $quoted_string; if ( $in_quote == 2 ) { # two quotes/quoted_string_1s to follow my $ibeg = $i; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index d22a265f..8fb992a2 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -3528,7 +3528,6 @@ sub get_line_token_info { $rtoken_patterns->{$lev_max} = $token_pattern_max; $rtoken_indexes->{$lev_max} = [ ( 0 .. $imax ) ]; - my $debug = 0; my $lev_top = pop @levs; # alread did max level my $itok = -1; foreach my $tok ( @{$rtokens} ) { @@ -3855,9 +3854,6 @@ sub prune_alignment_tree { # $ragged_comma_group{$id} = [ imax_group_min, imax_group_max ] ## my %ragged_comma_group; - # Define a threshold line count for forcing a break - my $nlines_break = 3; - # We work with a list of nodes to visit at the next deeper depth. my @todo_list; if ( defined( $match_tree[0] ) ) { -- 2.39.5