]> git.donarmstrong.com Git - perltidy.git/commitdiff
moved some error-checking code to better location
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 24 Dec 2019 15:18:53 +0000 (07:18 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 24 Dec 2019 15:18:53 +0000 (07:18 -0800)
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/VerticalAligner.pm

index 812ab1bcdfc361354d2035e877c0db6ba042e455..682fc62d67c53fe2fb36b84ee4239a57c064e4f7 100644 (file)
@@ -2997,10 +2997,7 @@ sub respace_tokens {
 
             # check a quote for problems
             elsif ( $type eq 'Q' ) {
-
-                # This is ready to go but is commented out because there is
-                # still identical logic in sub break_lines.
-                # $check_Q->($KK, $Kfirst);
+                $check_Q->( $KK, $Kfirst );
             }
 
             # handle semicolons
@@ -7430,40 +7427,6 @@ EOM
             $next_nonblank_token_type =
               $rinput_token_array->[$j_next]->[_TYPE_];
 
-            ######################
-            # MAYBE MOVE ELSEWHERE?
-            ######################
-            if ( $type eq 'Q' ) {
-                note_embedded_tab() if ( $token =~ "\t" );
-
-                # make note of something like '$var = s/xxx/yyy/;'
-                # in case it should have been '$var =~ s/xxx/yyy/;'
-                if (
-                       $token =~ /^(s|tr|y|m|\/)/
-                    && $last_nonblank_token =~ /^(=|==|!=)$/
-
-                    # preceded by simple scalar
-                    && $last_last_nonblank_type eq 'i'
-                    && $last_last_nonblank_token =~ /^\$/
-
-                    # followed by some kind of termination
-                    # (but give complaint if we can's see far enough ahead)
-                    && $next_nonblank_token =~ /^[; \)\}]$/
-
-                    # scalar is not declared
-                    && !(
-                           $types_to_go[0] eq 'k'
-                        && $tokens_to_go[0] =~ /^(my|our|local)$/
-                    )
-                  )
-                {
-                    my $guess = substr( $last_nonblank_token, 0, 1 ) . '~';
-                    complain(
-"Note: be sure you want '$last_nonblank_token' instead of '$guess' here\n"
-                    );
-                }
-            }
-
             # Do not allow breaks which would promote a side comment to a
             # block comment.  In order to allow a break before an opening
             # or closing BLOCK, followed by a side comment, those sections
@@ -11287,11 +11250,10 @@ sub lookup_opening_indentation {
         # updated per bug report in alex_bug.pl: we must not
         # mess with the indentation of closing logical braces so
         # we must treat something like '} else {' as if it were
-        # an isolated brace my $is_isolated_block_brace = (
-        # $iend == $ibeg ) && $block_type_to_go[$ibeg];
+        # an isolated brace
         #############################################################
         my $is_isolated_block_brace = $block_type_to_go[$ibeg]
-          && ( $iend == $ibeg
+          && ( $i_terminal == $ibeg
             || $is_if_elsif_else_unless_while_until_for_foreach{
                 $block_type_to_go[$ibeg]
             } );
index 50b3d225ecd798d6a5e2e156004abc4160e8f95f..ebd3c0730d791f3489b488f04214d9e43497f485 100644 (file)
@@ -1199,8 +1199,6 @@ sub fix_terminal_else {
     my $jmax = @{$rfields} - 1;
     return unless ( $jmax > 0 );
 
-    #my $old_line    = $group_lines[-1];
-
     # check for balanced else block following if/elsif/unless
     my $rfields_old = $old_line->get_rfields();