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

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Mar 1 09:44:43 UTC 2010


Author: bacek
Date: Mon Mar  1 09:44:42 2010
New Revision: 44566
URL: https://trac.parrot.org/parrot/changeset/44566

Log:
Fix parsing almost empty 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	Mon Mar  1 09:44:14 2010	(r44565)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Mon Mar  1 09:44:42 2010	(r44566)
@@ -46,13 +46,18 @@
         %flags{~$_<identifier>} := 1;
     }
 
+    my @args := list();
+    if ($<op_params>) {
+        @args := $<op_params>[0].ast;
+    }
+
     my $past := Ops::Op.new(
         :code(-1),
         :name(~$<op_name>),
         :type(~$<op_type>),
 
         :flags(%flags),
-        :args($<op_params>[0].ast),
+        :args(@args),
 
         $<op_body>.ast
     );

Modified: branches/ops_pct/compilers/opsc/t/03-past.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/03-past.t	Mon Mar  1 09:44:14 2010	(r44565)
+++ branches/ops_pct/compilers/opsc/t/03-past.t	Mon Mar  1 09:44:42 2010	(r44566)
@@ -18,14 +18,19 @@
 */
 END_OPS_PREAMBLE
 
+op bar() {
+    # Nothing here
+}
+
 inline op foo(out INT, in PMC, inconst NUM) :flow :deprecated {
     foo # We don't handle anything in C<body> during parse/past.
 }
+
 END
 
     compiler = compreg 'Ops'
     past = compiler.'compile'(buf, 'target'=>'past')
-    is(1, 1, "PAST::Node created")
+    ok(1, "PAST::Node created")
 
     $P0 = past['preamble']
     $P1 = $P0[0]
@@ -35,7 +40,7 @@
     $P0 = past['ops']
     $P0 = $P0.'list'()
     $I0 = $P0
-    is($I0, 1, 'We have 1 op')
+    is($I0, 2, 'We have 2 ops')
 
     # Check op
     .local pmc op


More information about the parrot-commits mailing list