]> git.donarmstrong.com Git - perltidy.git/commitdiff
remove 'map' from sub 'copy_token_as_type' for efficiency
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 18 Oct 2020 13:03:40 +0000 (06:03 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 18 Oct 2020 13:03:40 +0000 (06:03 -0700)
lib/Perl/Tidy/Formatter.pm

index 0e6edec5a8d9380c1420f84e5da9f8d2b87dc4d9..be46c90e1d818a65aeb36f6b6dc5cf605bd9fb52 100644 (file)
@@ -5315,13 +5315,13 @@ sub copy_token_as_type {
         );
     }
 
-    my $rnew_token = [ map { $_ } @{$rold_token} ];
-    $rnew_token->[_TYPE_]                  = $type;
-    $rnew_token->[_TOKEN_]                 = $token;
-    $rnew_token->[_BLOCK_TYPE_]            = '';
-    $rnew_token->[_CONTAINER_ENVIRONMENT_] = '';
-    $rnew_token->[_TYPE_SEQUENCE_]         = '';
-    return $rnew_token;
+    my @rnew_token = @{$rold_token};
+    $rnew_token[_TYPE_]                  = $type;
+    $rnew_token[_TOKEN_]                 = $token;
+    $rnew_token[_BLOCK_TYPE_]            = '';
+    $rnew_token[_CONTAINER_ENVIRONMENT_] = '';
+    $rnew_token[_TYPE_SEQUENCE_]         = '';
+    return \@rnew_token;
 }
 
 sub Debug_dump_tokens {