From fb2557ba79e4ea74769891ca9799072dbf687087 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 4 Jul 2022 17:58:23 -0700 Subject: [PATCH] small optimization --- lib/Perl/Tidy/Formatter.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3712de19..d59dacd8 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3092,19 +3092,20 @@ sub set_whitespace_flags { $rwhitespace_flags->[$j] = $ws; - if (DEBUG_WHITE) { - my $str = substr( $last_token, 0, 15 ); - $str .= SPACE x ( 16 - length($str) ); - if ( !defined($ws_1) ) { $ws_1 = "*" } - if ( !defined($ws_2) ) { $ws_2 = "*" } - if ( !defined($ws_3) ) { $ws_3 = "*" } - if ( !defined($ws_4) ) { $ws_4 = "*" } - print STDOUT + next if ( !DEBUG_WHITE ); + + my $str = substr( $last_token, 0, 15 ); + $str .= SPACE x( 16 - length($str) ); + if ( !defined($ws_1) ) { $ws_1 = "*" } + if ( !defined($ws_2) ) { $ws_2 = "*" } + if ( !defined($ws_3) ) { $ws_3 = "*" } + if ( !defined($ws_4) ) { $ws_4 = "*" } + print STDOUT "NEW WHITE: i=$j $str $last_type $type $ws_1 : $ws_2 : $ws_3 : $ws_4 : $ws \n"; - # reset for next pass - $ws_1 = $ws_2 = $ws_3 = $ws_4 = undef; - } + # reset for next pass + $ws_1 = $ws_2 = $ws_3 = $ws_4 = undef; + } ## end main loop if ( $rOpts->{'tight-secret-operators'} ) { -- 2.39.5