[svn:parrot] r44745 - in branches/ops_pct/compilers/opsc: src/Ops/Compiler t

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Mar 7 20:52:42 UTC 2010


Author: bacek
Date: Sun Mar  7 20:52:39 2010
New Revision: 44745
URL: https://trac.parrot.org/parrot/changeset/44745

Log:
Append 'goto NEXT' to :flow ops

Modified:
   branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
   branches/ops_pct/compilers/opsc/t/03-past.t

Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Sun Mar  7 20:08:19 2010	(r44744)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Sun Mar  7 20:52:39 2010	(r44745)
@@ -78,6 +78,13 @@
     $op<type>  := ~$<op_type>;
     $op<normalized_args> := @norm_args;
 
+    if %flags<flow> {
+        $op.push(PAST::Op.new(
+            :pasttype('inline'),
+            :inline("\ngoto NEXT()\n")
+            ));
+    }
+
     my $past := PAST::Stmts.new(
         :node($/)
     );

Modified: branches/ops_pct/compilers/opsc/t/03-past.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/03-past.t	Sun Mar  7 20:08:19 2010	(r44744)
+++ branches/ops_pct/compilers/opsc/t/03-past.t	Sun Mar  7 20:52:39 2010	(r44745)
@@ -7,7 +7,7 @@
 pir::load_bytecode('nqp-settings.pbc');
 pir::load_bytecode('dumper.pbc');
 
-plan(25);
+plan(26);
 
 my $buf := q|
 BEGIN_OPS_PREAMBLE    
@@ -83,11 +83,16 @@
 ok($arg<type> eq 'nc', 'Third type is correct');
 ok(!($arg<variant>), 'Third arg without variant');
 
-ok( ($op<args_types>).join('_') eq 'i_p_nc', "First variant correct");
+ok( ($op.arg_types).join('_') eq 'i_p_nc', "First variant correct");
+
+# Check body munching.
+ok( $op.body ~~ /goto \s NEXT/, "goto NEXT appended for :flow ops");
 
 # Second created op should have _pc_
 $op := @ops[2];
-ok( $op<args_types>.join('_') eq 'i_pc_nc', "Second variant correct");
+ok( $op.arg_types.join('_') eq 'i_pc_nc', "Second variant correct");
+
+
 
 # Don't forget to update plan!
 


More information about the parrot-commits mailing list