From 844b7d1458fcee10fb3ad54b87e8e7919d6d8b93 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 27 Jun 2021 18:29:46 -0700 Subject: [PATCH] moved an error check from VerticalAligner to Formatter --- lib/Perl/Tidy/Formatter.pm | 13 +++++++++++++ lib/Perl/Tidy/VerticalAligner.pm | 18 ------------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 222c6c33..de619024 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -19013,6 +19013,19 @@ sub send_lines_to_vertical_aligner { $rfield_lengths->[-1] += 2; } + # Programming check: (shouldn't happen) + # The number of tokens which separate the fields must always be + # one less than the number of fields. If this is not true then + # an error has been introduced in sub make_alignment_patterns. + if ( @{$rfields} && ( @{$rtokens} != ( @{$rfields} - 1 ) ) ) { + my $nt = @{$rtokens}; + my $nf = @{$rfields}; + my $msg = <is_list_by_K($Kbeg); diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index f8a476fa..198d8649 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -637,24 +637,6 @@ sub valign_input { $self->[_zero_count_] = 0; } - # programming check: (shouldn't happen) - # The number of tokens which separate the fields must always be - # one less than the number of fields. If this is not true then - # an error has been made by the Formatter in defining these - # quantities. See Formatter.pm/sub make_alignment_patterns. - if ( @{$rfields} && ( @{$rtokens} != ( @{$rfields} - 1 ) ) ) { - my $nt = @{$rtokens}; - my $nf = @{$rfields}; - my $msg = <warning($msg); - $self->report_definite_bug(); - - # TODO: this has never happened, but we should probably call Die here. - # Needs some testing - # Perl::Tidy::Die($msg); - } my $maximum_line_length_for_level = $self->maximum_line_length_for_level($level); -- 2.39.5