From f0c2f31f975c711c9a6f7801b6fe1ef2a3a5b325 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 9 Oct 2020 05:23:03 -0700 Subject: [PATCH] removed some unused code --- lib/Perl/Tidy/Formatter.pm | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3edd23a5..a42f9b14 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -312,6 +312,7 @@ BEGIN { _K_closing_container_ => $i++, _K_opening_ternary_ => $i++, _K_closing_ternary_ => $i++, + _K_first_seq_item_ => $i++, _rK_phantom_semicolons_ => $i++, _rtype_count_by_seqno_ => $i++, _ris_broken_container_ => $i++, @@ -608,6 +609,7 @@ sub new { $self->[_K_closing_container_] = {}; # for quickly traversing structure $self->[_K_opening_ternary_] = {}; # for quickly traversing structure $self->[_K_closing_ternary_] = {}; # for quickly traversing structure + $self->[_K_first_seq_item_] = undef; # K of first token with a sequence # $self->[_rK_phantom_semicolons_] = undef; # for undoing phantom semicolons if iterating $self->[_rtype_count_by_seqno_] = {}; @@ -4272,9 +4274,6 @@ sub dump_verbatim { # Handle a block (full-line) comment.. if ($is_block_comment) { - # TRIM COMMENTS -- This could be turned off as a option - $rLL->[$Kfirst]->[_TOKEN_] =~ s/\s*$//; # trim right end - if ($is_static_block_comment_without_leading_space) { return 'SBCX'; } @@ -4441,22 +4440,6 @@ sub respace_tokens { my $rparent_of_seqno = {}; my $rchildren_of_seqno = {}; - # a sub to link preceding nodes forward to a new node type - my $link_back = sub { - my ( $Ktop, $key ) = @_; - - my $Kprev = $Ktop - 1; - while ( $Kprev >= 0 - && !defined( $rLL_new->[$Kprev]->[$key] ) ) - { - $rLL_new->[$Kprev]->[$key] = $Ktop; - $Kprev -= 1; - } - }; - - # A sub to store one token in the new array - # All new tokens must be stored by this sub so that it can update - # all data structures on the fly. my $last_nonblank_type = ';'; my $last_nonblank_token = ';'; my $last_nonblank_block_type = ''; @@ -4471,9 +4454,6 @@ sub respace_tokens { my $type_sequence = $item->[_TYPE_SEQUENCE_]; if ($type_sequence) { - ## moved below, this was very slow - ##$link_back->( $KK_new, _KNEXT_SEQ_ITEM_ ); - my $token = $item->[_TOKEN_]; if ( $is_opening_token{$token} ) { @@ -5288,6 +5268,7 @@ sub respace_tokens { $rLL_new->[$KK]->[_KNEXT_SEQ_ITEM_] = $KNEXT; if ( $rLL_new->[$KK]->[_TYPE_SEQUENCE_] ) { $KNEXT = $KK } } + $self->[_K_first_seq_item_] = $KNEXT; } # Reset memory to be the new array -- 2.39.5