]> git.donarmstrong.com Git - perltidy.git/commitdiff
eliminate some unnecessary sub calls
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 31 Oct 2020 13:53:12 +0000 (06:53 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 31 Oct 2020 13:53:12 +0000 (06:53 -0700)
lib/Perl/Tidy/VerticalAligner.pm

index d6170dd0cfecf227a59ee0796e34861da2109699..b382c1800c2eee787e49e1772ee28e8e25140142 100644 (file)
@@ -466,28 +466,29 @@ sub valign_input {
     # token with the closing token to follow, then we will mark both
     # cached flags as valid.
     my $cached_line_type = get_cached_line_type();
-    my $cached_line_flag = get_cached_line_flag();
-    my $cached_seqno     = get_cached_seqno();
-    if ($rvertical_tightness_flags) {
-        if (   $cached_line_type
-            && $cached_seqno
-            && $self->group_line_count() <= 1
-            && $rvertical_tightness_flags->[2]
-            && $rvertical_tightness_flags->[2] == $cached_seqno )
-        {
-            $rvertical_tightness_flags->[3] ||= 1;
-            set_cached_line_valid(1);
+    if ($cached_line_type) {
+        my $cached_line_flag = get_cached_line_flag();
+        if ($rvertical_tightness_flags) {
+            my $cached_seqno = get_cached_seqno();
+            if (   $cached_seqno
+                && $self->group_line_count() <= 1
+                && $rvertical_tightness_flags->[2]
+                && $rvertical_tightness_flags->[2] == $cached_seqno )
+            {
+                $rvertical_tightness_flags->[3] ||= 1;
+                set_cached_line_valid(1);
+            }
         }
-    }
 
-    # do not join an opening block brace with an unbalanced line
-    # unless requested with a flag value of 2
-    if (   $cached_line_type == 3
-        && !$self->group_line_count()
-        && $cached_line_flag < 2
-        && $level_jump != 0 )
-    {
-        set_cached_line_valid(0);
+        # do not join an opening block brace with an unbalanced line
+        # unless requested with a flag value of 2
+        if (   $cached_line_type == 3
+            && !$self->group_line_count()
+            && $cached_line_flag < 2
+            && $level_jump != 0 )
+        {
+            set_cached_line_valid(0);
+        }
     }
 
     # caller might request no alignment in special cases