]> git.donarmstrong.com Git - perltidy.git/commitdiff
moved an error check from VerticalAligner to Formatter
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 28 Jun 2021 01:29:46 +0000 (18:29 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 28 Jun 2021 01:29:46 +0000 (18:29 -0700)
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/VerticalAligner.pm

index 222c6c337c5968d4f3b095413370430200df8531..de61902495345ede291ef15128bcd6a0ed001d00 100644 (file)
@@ -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 = <<EOM;
+"Program bug in Perl::Tidy::Formatter - number of tokens = $nt should be one less than number of fields: $nf)\n"
+EOM
+            Fault($msg);
+        }
+
         # Set flag which tells if this line is contained in a multi-line list
         my $list_seqno = $self->is_list_by_K($Kbeg);
 
index f8a476fabeddb2e06fe21e1ee0e0db971714fd1e..198d864922e6e8afaae0f268dc1ff8710b819935 100644 (file)
@@ -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 = <<EOM;
-"Program bug in Perl::Tidy::VerticalAligner - number of tokens = $nt should be one less than number of fields: $nf)\n"
-EOM
-        $self->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);