From a6943f583ba854c432bc7cfd58342b08343faa4b Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 27 Jul 2022 09:04:35 -0700 Subject: [PATCH] minor optimization --- lib/Perl/Tidy/Formatter.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index b1f30e81..e98ae5de 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -519,6 +519,7 @@ BEGIN { _rix_seqno_controlling_ci_ => $i++, _batch_CODE_type_ => $i++, _ri_starting_one_line_block_ => $i++, + _has_unmatched_opening_ => $i++, }; } @@ -14799,6 +14800,9 @@ EOM my $is_unbalanced_batch = @unmatched_opening_indexes_in_this_batch + @unmatched_closing_indexes_in_this_batch; + $this_batch->[_has_unmatched_opening_] = + @unmatched_opening_indexes_in_this_batch; + #------------------------ # Set special breakpoints #------------------------ @@ -22969,7 +22973,8 @@ EOM # remember indentation of lines containing opening containers for # later use by sub final_indentation_adjustment $self->save_opening_indentation( $ri_first, $ri_last, $rindentation_list ) - if ( !$is_block_comment ); + if ( $this_batch->[_has_unmatched_opening_] + || $types_to_go[$max_index_to_go] eq 'q' ); # output any new -cscw block comment if ($cscw_block_comment) { -- 2.39.5