From: Steve Hancock Date: Thu, 30 Apr 2020 23:44:03 +0000 (-0700) Subject: fix to allow both -dbc and -tbc in same run X-Git-Tag: 20200619~54 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=30ade648a4614d29d808b70350a71405eb4614d1;p=perltidy.git fix to allow both -dbc and -tbc in same run --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 37ef42a7..c770898b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -1496,12 +1496,6 @@ sub break_lines { next; } - # Handle block comment to be deleted - elsif ( $CODE_type eq 'DEL' ) { - $self->flush(); - next; - } - # Handle all other lines of code $self->process_line_of_CODE($line_of_tokens); } @@ -2645,7 +2639,6 @@ sub respace_tokens { # 'SBC'=Static Block Comment - a block comment which does not get # indented # 'SBCX'=Static Block Comment Without Leading Space - # 'DEL'=Delete this line # 'VER'=VERSION statement # '' or (undefined) - no restructions @@ -3125,7 +3118,6 @@ sub respace_tokens { # 'SBC'=Static Block Comment - a block comment which does not get # indented # 'SBCX'=Static Block Comment Without Leading Space - # 'DEL'=Delete this line # 'VER'=VERSION statement # '' or (undefined) - no restructions @@ -3262,8 +3254,6 @@ sub respace_tokens { # Handle a block (full-line) comment.. if ($is_block_comment) { - if ( $rOpts->{'delete-block-comments'} ) { return 'DEL' } - # TRIM COMMENTS -- This could be turned off as a option $rLL->[$Kfirst]->[_TOKEN_] =~ s/\s*$//; # trim right end @@ -7219,6 +7209,10 @@ sub copy_token_as_type { if ( $rOpts->{'tee-block-comments'} ) { $sink_object->write_tee_line($input_line); } + if ( $rOpts->{'delete-block-comments'} ) { + $self->flush(); + return; + } destroy_one_line_block(); $self->process_batch_of_CODE();