Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[Perl6::Actions] refactor

De-duplicated some code. This will help us during
the next commit, because we'll be adding more
code in that path.
  • Loading branch information...
commit e7ab9ace23569bb2d5fe5550288efb8c0cbacd4b 1 parent c45b029
Carl Mäsak authored

Showing 1 changed file with 9 additions and 7 deletions. Show diff stats Hide diff stats

  1. 16  src/Perl6/Actions.pm
16  src/Perl6/Actions.pm
@@ -3484,18 +3484,20 @@ class Perl6::Actions is HLL::Actions does STDActions {
3484 3484
         }
3485 3485
     }
3486 3486
 
3487  
-    sub add_macro_arguments($expr, $ast_class, @argument_quasi_asts) {
  3487
+    sub add_macro_arguments($expr, $ast_class, @argument_asts) {
  3488
+        sub wrap_and_add_expr($expr) {
  3489
+            my $quasi_ast := $ast_class.new();
  3490
+            nqp::bindattr($quasi_ast, $ast_class, '$!past', $expr);
  3491
+            @argument_asts.push($quasi_ast);
  3492
+        }
  3493
+
3488 3494
         if nqp::istype($expr, QAST::Op) && $expr.name eq '&infix:<,>' {
3489 3495
             for $expr.list {
3490  
-                my $quasi_ast := $ast_class.new();
3491  
-                nqp::bindattr($quasi_ast, $ast_class, '$!past', $_);
3492  
-                @argument_quasi_asts.push($quasi_ast);
  3496
+                wrap_and_add_expr($_);
3493 3497
             }
3494 3498
         }
3495 3499
         else {
3496  
-            my $quasi_ast := $ast_class.new();
3497  
-            nqp::bindattr($quasi_ast, $ast_class, '$!past', $expr);
3498  
-            @argument_quasi_asts.push($quasi_ast);
  3500
+            wrap_and_add_expr($expr);
3499 3501
         }
3500 3502
     }
3501 3503
 

0 notes on commit e7ab9ac

Please sign in to comment.
Something went wrong with that request. Please try again.