[svn:parrot] r35917 - trunk/examples/pir
[email protected] Fri, 23 Jan 2009 12:22:58 -0800 (PST)
| Newsgroups | perl.cvs.parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: julianalbo
Date: Fri Jan 23 12:22:57 2009
New Revision: 35917
Modified:
trunk/examples/pir/pirric.pir
Log:
pirric: pass arguments to functor calls
Modified: trunk/examples/pir/pirric.pir
==============================================================================
--- trunk/examples/pir/pirric.pir (original)
+++ trunk/examples/pir/pirric.pir Fri Jan 23 12:22:57 2009
@@ -885,6 +885,24 @@
.end
#-----------------------------------------------------------------------
+.sub get_args_and_call :method
+ .param pmc tokenizer
+ .param pmc fun
+
+ .local pmc args, result
+
+ args = self.'get_args'(tokenizer)
+ $I0 = defined args
+ unless $I0 goto emptyargs
+ result = fun(args :flat)
+ goto done
+emptyargs:
+ result = fun()
+done:
+ .return(result)
+.end
+
+#-----------------------------------------------------------------------
.sub eval_base :method
.param pmc tokenizer
.param pmc token :optional
@@ -990,10 +1008,11 @@
isfunctor:
#say 'Functor'
- args = self.'get_args'(tokenizer)
- $P3 = var()
+
+ $P3 = self.'get_args_and_call'(tokenizer, var)
.return($P3)
+
dotted:
$P3 = tokenizer.'get'()
$P4 = tokenizer.'get'()