From: Steve Hancock Date: Wed, 21 Feb 2024 14:51:34 +0000 (-0800) Subject: add devel mode arg count check on subs with >6 args X-Git-Tag: 20240202.03~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=475174e869c89cf89bd166b8221771032cc1729e;p=perltidy.git add devel mode arg count check on subs with >6 args --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 6ad41bc0..6ba37913 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -24586,8 +24586,13 @@ sub break_lines_inner_loop { $line_count, $rbond_strength_to_go, $saw_good_break, + ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) { + Fault("arg count $count expected to be $expected_count\n"); + } + # Given: # $i_begin = first index of range # $i_last_break = index of previous break @@ -32549,6 +32554,10 @@ sub make_paren_name { ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) { + Fault("arg count $count expected to be $expected_count\n"); + } + #-------------------------------------------------------------- # This routine makes any necessary adjustments to get the final # indentation of a line in the Formatter. @@ -33063,6 +33072,10 @@ sub make_paren_name { ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 10 ) ) { + Fault("arg count $count expected to be $expected_count\n"); + } + my $adjust_indentation = 0; my $default_adjust_indentation = $adjust_indentation; my $terminal_type = $types_to_go[$i_terminal]; @@ -33593,6 +33606,10 @@ sub set_vertical_tightness_flags { ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) { + Fault("arg count $count expected to be $expected_count\n"); + } + # Define vertical tightness controls for the nth line of a batch. # Note: do not call this sub for a block comment or if # $rOpts_freeze_whitespace is set. diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 12885e70..c39e2fa0 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -7744,6 +7744,11 @@ sub scan_bare_identifier_do { $max_token_index ) = @_; + + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); + } + my $i_begin = $i; my $package = undef; @@ -7979,6 +7984,11 @@ sub scan_id_do { $max_token_index ) = @_; + + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); + } + use constant DEBUG_NSCAN => 0; my $type = EMPTY_STRING; my ( $i_beg, $pos_beg ); @@ -8859,8 +8869,13 @@ sub do_scan_package { $max_token_index, $expecting, $container_type + ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); + } + # return flag telling caller to split the pretoken my $split_pretoken_flag; @@ -10093,9 +10108,22 @@ sub find_here_doc { # $i - unchanged if not here doc, # or index of the last token of the here target # $saw_error - flag noting unbalanced quote on here target - my ( $self, $expecting, $i, $rtokens, $rtoken_type, $rtoken_map, - $max_token_index ) - = @_; + my ( + + $self, + + $expecting, + $i, + $rtokens, + $rtoken_type, + $rtoken_map, + $max_token_index + + ) = @_; + + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 7 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); + } my $ibeg = $i; my $found_target = 0; @@ -10225,6 +10253,7 @@ sub do_quote { my ( $self, + $i, $in_quote, $quote_character, @@ -10239,9 +10268,8 @@ sub do_quote { ) = @_; - if ( DEVEL_MODE && @_ != ( my $my_count = 12 ) ) { - my $count = @_; - $self->Fault("arg count $count expected to be $my_count\n"); + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 12 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); } my $quoted_string; @@ -10348,6 +10376,7 @@ sub follow_quoted_string { my ( $self, + $i_beg, $in_quote, $rtokens, @@ -10359,6 +10388,10 @@ sub follow_quoted_string { ) = @_; + if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) { + $self->Fault("arg count $count expected to be $expected_count\n"); + } + my ( $tok, $end_tok ); my $i = $i_beg - 1; my $quoted_string = EMPTY_STRING;