]> git.donarmstrong.com Git - perltidy.git/commitdiff
remove unused vars
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 20 Feb 2023 23:56:12 +0000 (15:56 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 20 Feb 2023 23:56:12 +0000 (15:56 -0800)
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
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm

index 57b034b0e5ec2686ebb8ed44aac2c4f0dd26c781..f9eb582297b8ba33fd306d3724497df9e678c65a 100644 (file)
@@ -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 .= <<EOM;
  $last_nonblank_count:$last_nonblank_line
 EOM
@@ -5035,7 +5034,6 @@ sub read_config_file {
         # See rules in perltidy's perldoc page
         # Section: Other Controls - Creating a new abbreviation
         if ( $line =~ /^((\w+)\s*\{)(.*)?$/ ) {
-            my $oldname = $name;
             ( $name, $body ) = ( $2, $3 );
 
             # Cannot start new abbreviation unless old abbreviation is complete
index f160591927ae7d0ebde5c6401ffb99f1e337deeb..c091b2f02be0b24e14ecaf33b6c27fa3a54bcecf 100644 (file)
@@ -6306,7 +6306,6 @@ sub find_selected_packages {
     my $K_closing_container = $self->[_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 (
index 43617e233ac5c6debbeaac3c213ff39776c23b75..e8d47e81d54a633f8bfd36d6a9c46d34dbdd9869 100644 (file)
@@ -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};
 
index 0d45e7459ee2abc70226fd7124fddd621c2d6aa6..a48495f886b61a0aba34bcfb95b0219e53442ca5 100644 (file)
@@ -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;
index d22a265fdb0a20361732dfaf1c12095a384e8585..8fb992a218b401c781fcaef2446c6c908d55b0af 100644 (file)
@@ -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] ) ) {