Author: pmichaud
Date: Fri Aug 15 22:44:06 2008
New Revision: 30258

Modified:
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Convert :inline to use list of strings instead of concat.


Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Fri Aug 15 22:44:06 2008
@@ -27,7 +27,7 @@
     }
 
     # Make sure we have the interpinfo constants.
-    $past.unshift( PAST::Op.new( :inline(".include \"interpinfo.pasm\"\n") ) );
+    $past.unshift( PAST::Op.new( :inline('.include "interpinfo.pasm"') ) );
 
     make $past;
 }
@@ -504,7 +504,7 @@
                 :scope('lexical'),
                 :isdecl(1)
             ),
-            PAST::Op.new(:inline("    %r = self\n"))
+            PAST::Op.new(:inline('    %r = self'))
         ));
 
         # Set up the block details.
@@ -641,7 +641,7 @@
                 )
             ),
             PAST::Op.new(
-                :inline("    setprop %0, 'enum', %1\n"),
+                :inline('    setprop %0, "enum", %1'),
                 PAST::Var.new(
                     :name('$def'),
                     :scope('lexical')
@@ -1025,17 +1025,17 @@
         # For signatures, we build a list from the constraints and store it.
         my $sig_type_cons := PAST::Stmts.new(
             PAST::Op.new(
-                :inline("    $P2 = new 'List'\n")
+                :inline('    $P2 = new "List"')
             ),
             PAST::Stmts.new(),
             PAST::Op.new(
-                :inline("    %r = $P2\n")
+                :inline('    %r = $P2')
             )
         );
         for @($cur_param_types) {
             # Just want the type, not the call to the checker.
             $sig_type_cons[1].push(PAST::Op.new(
-                :inline("    push $P2, %0\n"),
+                :inline('    push $P2, %0'),
                 $_[0]
             ));
         }
@@ -1055,9 +1055,11 @@
                         :scope('lexical')
                     ),
                     PAST::Op.new(
-                        :inline(" %r = new 'Perl6Scalar', %0\n" ~
-                                " $P0 = get_hll_global ['Bool'], 'True'\n" ~
-                                " setprop %r, 'readonly', $P0\n"),
+                        :inline(
+                            '    %r = new "Perl6Scalar", %0',
+                            '    $P0 = get_hll_global ["Bool"], "True"',
+                            '    setprop %r, "readonly", $P0'
+                        ),
                         PAST::Var.new(
                             :name($parameter.name()),
                             :scope('lexical')
@@ -1074,8 +1076,10 @@
                     :scope('lexical')
                     ),
                     PAST::Op.new(
-                        :inline(" %r = new 'Perl6Scalar'\n" ~
-                                " %r.'infix:='(%0)\n"),
+                        :inline(
+                            '    %r = new "Perl6Scalar"',
+                            '    %r."infix:="(%0)'
+                        ),
                         PAST::Var.new(
                             :name($parameter.name()),
                             :scope('lexical')
@@ -3031,10 +3035,12 @@
             # For block type; defaults to Block
             PAST::Stmts.new(
                 PAST::Op.new(
-                    :inline("    .local pmc desc\n" ~
-                            "    $P0 = interpinfo .INTERPINFO_CURRENT_SUB\n" ~
-                            "    $P0 = $P0.'get_outer'()\n" ~
-                            "    setprop $P0, '$!proto', %0\n"),
+                    :inline(
+                        '    .local pmc desc',
+                        '    $P0 = interpinfo .INTERPINFO_CURRENT_SUB',
+                        '    $P0 = $P0."get_outer"()',
+                        '    setprop $P0, "$!proto", %0'
+                    ),
                     PAST::Var.new(
                         :name('Block'),
                         :scope('package')
@@ -3045,7 +3051,7 @@
             # For signature setup - default to empty signature object.
             PAST::Stmts.new(
                 PAST::Op.new(
-                    :inline("    setprop $P0, '$!signature', %0\n"),
+                    :inline('    setprop $P0, "$!signature", %0'),
                     PAST::Op.new(
                         :pasttype('callmethod'),
                         :name('!create'),
@@ -3080,16 +3086,16 @@
 # Creates a signature descriptor (for now, just a hash).
 sub sig_descriptor_create() {
     PAST::Stmts.new(
-        PAST::Op.new( :inline("    $P1 = new 'Hash'\n") ),
+        PAST::Op.new( :inline('    $P1 = new "Hash"') ),
         PAST::Stmts.new(),
-        PAST::Op.new( :inline("    %r = $P1\n") )
+        PAST::Op.new( :inline('    %r = $P1') )
     )
 }
 
 # Sets a given value in the signature descriptor.
 sub sig_descriptor_set($descriptor, $name, $value) {
     $descriptor[1].push(PAST::Op.new(
-        :inline("    $P1[%0] = %1\n"),
+        :inline('    $P1[%0] = %1'),
         PAST::Val.new( :value(~$name) ),
         $value
     ));
@@ -3140,9 +3146,11 @@
     }
     else {
         $getset := PAST::Op.new(
-            :inline("    %r = new 'Perl6Scalar', %0\n" ~
-                    "    $P0 = get_hll_global [ 'Bool' ], 'True'\n" ~
-                    "    setprop %r, 'readonly', $P0\n"),
+            :inline(
+                '    %r = new "Perl6Scalar", %0',
+                '    $P0 = get_hll_global [ "Bool" ], "True"',
+                '    setprop %r, "readonly", $P0'
+            ),
             PAST::Var.new( :name($attr_name), :scope($scope) )
         );
     }
@@ -3238,7 +3246,7 @@
         :pasttype('call'),
         :name('!TYPECHECKPARAM'),
         PAST::Op.new(
-            :inline("    %r = newclosure %0\n"),
+            :inline('    %r = newclosure %0'),
             $past
         ),
         PAST::Var.new(

Reply via email to