]> git.donarmstrong.com Git - perltidy.git/commitdiff
minor speedup
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 5 Nov 2020 00:07:39 +0000 (16:07 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 5 Nov 2020 00:07:39 +0000 (16:07 -0800)
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm

index f1d4af1b919a054a70635eb5a5f0c0ed5e9e80f5..ab9803c502db9c113a1c2c38d835e8d8dba7ea2f 100644 (file)
@@ -2843,17 +2843,21 @@ sub prepare_for_a_new_file {
 
         chomp $input_line;
 
+        # Set a flag to indicate if we might be at an __END__ or __DATA__ line
+        # This will be used below to avoid quoting a bare word followed by
+        # a fat comma.
+        my $is_END_or_DATA; 
+
         # trim start of this line unless we are continuing a quoted line
         # do not trim end because we might end in a quote (test: deken4.pl)
         # Perl::Tidy::Formatter will delete needless trailing blanks
         unless ( $in_quote && ( $quote_type eq 'Q' ) ) {
             $input_line =~ s/^\s+//;    # trim left end
+
+            $is_END_or_DATA = substr( $input_line, 0, 1 ) eq '_'
+              && $input_line =~ /^\s*__(END|DATA)__\s*$/;
         }
 
-        # Set a flag to indicate if we might be at an __END__ or __DATA__ line
-        # This will be used below to avoid quoting a bare word followed by
-        # a fat comma.
-        my $is_END_or_DATA = $input_line =~ /^\s*__(END|DATA)__\s*$/;
 
         # update the copy of the line for use in error messages
         # This must be exactly what we give the pre_tokenizer
index e23920b46974a5130396cfb9a5e47aa48f15ad6e..0e5da7ff30c85eb1cd80fbed4993a632f6bea677 100644 (file)
@@ -3984,15 +3984,15 @@ sub get_output_line_number {
         # and closing tokens.
         ###############################################################
 
-        my ( $self, $rinput_hash ) = @_;
-
-        my $leading_space_count       = $rinput_hash->{leading_space_count};
-        my $str                       = $rinput_hash->{line};
-        my $str_length                = $rinput_hash->{line_length};
-        my $side_comment_length       = $rinput_hash->{side_comment_length};
-        my $outdent_long_lines        = $rinput_hash->{outdent_long_lines};
-        my $rvertical_tightness_flags = $rinput_hash->{rvertical_tightness_flags};
-        my $level                     = $rinput_hash->{level};
+        my ( $self, $rinput ) = @_;
+
+        my $leading_space_count       = $rinput->{leading_space_count};
+        my $str                       = $rinput->{line};
+        my $str_length                = $rinput->{line_length};
+        my $side_comment_length       = $rinput->{side_comment_length};
+        my $outdent_long_lines        = $rinput->{outdent_long_lines};
+        my $rvertical_tightness_flags = $rinput->{rvertical_tightness_flags};
+        my $level                     = $rinput->{level};
 
         my $last_level_written = $self->[_last_level_written_];