]> git.donarmstrong.com Git - perltidy.git/commitdiff
minor efficiency improvements
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 11 Oct 2020 13:14:08 +0000 (06:14 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 11 Oct 2020 13:14:08 +0000 (06:14 -0700)
lib/Perl/Tidy/VerticalAligner.pm

index 56dbeb8abc1620f8bf0866fbe01d8b0205ec9b77..05ba52d49efe89f18c80df3bd99db8d7aa9ae950 100644 (file)
@@ -244,9 +244,7 @@ sub initialize_for_new_group {
 }
 
 sub group_line_count {
-    my $self   = shift;
-    my $nlines = @{ $self->[_rgroup_lines_] };
-    return $nlines;
+    return +@{ $_[0]->[_rgroup_lines_] };
 }
 
 # interface to Perl::Tidy::Diagnostics routines
@@ -311,15 +309,6 @@ sub get_recoverable_spaces {
     return ref($indentation) ? $indentation->get_recoverable_spaces() : 0;
 }
 
-sub make_alignment {
-    my ($col) = @_;
-
-    # make one new alignment at column $col
-    my $alignment =
-      Perl::Tidy::VerticalAligner::Alignment->new( column => $col, );
-    return $alignment;
-}
-
 sub maximum_line_length_for_level {
 
     # return maximum line length for line starting with a given level
@@ -478,9 +467,9 @@ sub valign_input {
     my $cached_line_flag = get_cached_line_flag();
     my $cached_seqno     = get_cached_seqno();
     if ($rvertical_tightness_flags) {
-        if (   $self->group_line_count() <= 1
-            && $cached_line_type
+        if (   $cached_line_type
             && $cached_seqno
+            && $self->group_line_count() <= 1
             && $rvertical_tightness_flags->[2]
             && $rvertical_tightness_flags->[2] == $cached_seqno )
         {
@@ -1378,7 +1367,8 @@ sub install_new_alignments {
         $col += $rfield_lengths->[$j];
 
         # create initial alignments for the new group
-        my $alignment = make_alignment($col);    ##, $token );
+        my $alignment =
+          Perl::Tidy::VerticalAligner::Alignment->new( column => $col );
         $new_line->set_alignment( $j, $alignment );
     }
     return;