From: Steve Hancock Date: Fri, 30 Oct 2020 01:43:17 +0000 (-0700) Subject: misc code cleanups X-Git-Tag: 20201001.03~22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=83b9e42e3ccb51d64eccdc968f0a07042122f9bd;p=perltidy.git misc code cleanups --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ae151e03..edbe2c99 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3406,7 +3406,7 @@ EOM #--------------------------------------------------------------- # Do not allow a break within welds, - if ($seqno) { + if ( $seqno && $total_weld_count ) { if ( $self->weld_len_right( $seqno, $type ) ) { $strength = NO_BREAK; } @@ -8472,9 +8472,6 @@ sub prepare_for_next_batch { my $type = $rtoken_vars->[_TYPE_]; my $block_type = $rtoken_vars->[_BLOCK_TYPE_]; my $type_sequence = $rtoken_vars->[_TYPE_SEQUENCE_]; - my $level = $rtoken_vars->[_LEVEL_]; - my $slevel = $rtoken_vars->[_SLEVEL_]; - my $ci_level = $rtoken_vars->[_CI_LEVEL_]; if ( $type eq '#' ) { @@ -8550,6 +8547,10 @@ sub prepare_for_next_batch { # sub scan_list, which is better suited to dealing with them. if ($is_opening_BLOCK) { + my $level = $rtoken_vars->[_LEVEL_]; + my $slevel = $rtoken_vars->[_SLEVEL_]; + my $ci_level = $rtoken_vars->[_CI_LEVEL_]; + # Tentatively output this token. This is required before # calling starting_one_line_block. We may have to unstore # it, though, if we have to break before it. @@ -15471,7 +15472,10 @@ sub excess_line_length { $summed_lengths_to_go[$ibeg]; # Include right weld lengths unless requested not to. - if ( !$ignore_right_weld && $type_sequence_to_go[$iend] ) { + if ( !$ignore_right_weld + && $type_sequence_to_go[$iend] + && $total_weld_count ) + { my $wr = $self->weld_len_right( $type_sequence_to_go[$iend], $types_to_go[$iend] ); $length += $wr;