[svn:parrot] r42156 - in trunk/compilers/pct/src: PAST POST

jonathan at svn.parrot.org jonathan at svn.parrot.org
Wed Oct 28 13:46:00 UTC 2009


Author: jonathan
Date: Wed Oct 28 13:45:58 2009
New Revision: 42156
URL: https://trac.parrot.org/parrot/changeset/42156

Log:
[pct] Add initial bits of support to PAST and POST for handling :call_sig parameters.

Modified:
   trunk/compilers/pct/src/PAST/Compiler.pir
   trunk/compilers/pct/src/PAST/Node.pir
   trunk/compilers/pct/src/POST/Node.pir

Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	Wed Oct 28 09:25:44 2009	(r42155)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Wed Oct 28 13:45:58 2009	(r42156)
@@ -2080,9 +2080,10 @@
     goto param_done
 
   param_required:
-    .local int slurpy
+    .local int call_sig, slurpy
+    call_sig = node.'call_sig'()
     slurpy = node.'slurpy'()
-    subpost.'add_param'(pname, 'named'=>named, 'slurpy'=>slurpy)
+    subpost.'add_param'(pname, 'named'=>named, 'slurpy'=>slurpy, 'call_sig'=>call_sig)
 
   param_done:
     name = self.'escape'(name)

Modified: trunk/compilers/pct/src/PAST/Node.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Node.pir	Wed Oct 28 09:25:44 2009	(r42155)
+++ trunk/compilers/pct/src/PAST/Node.pir	Wed Oct 28 13:45:58 2009	(r42156)
@@ -241,6 +241,22 @@
 .end
 
 
+=item call_sig([flag])
+
+Get/set the node's C<call_sig> attribute (for parameter variables) to C<flag>.
+A true value of C<call_sig> indicates that the parameter variable given by this
+node is to be created as a C<:call_sig> parameter. If you use this, it should be
+the only parameter.
+
+=cut
+
+.sub 'call_sig' :method
+    .param pmc value           :optional
+    .param int has_value       :opt_flag
+    .tailcall self.'attr'('call_sig', value, has_value)
+.end
+
+
 =item viviself([type])
 
 If the variable needs to be instantiated, then C<type> indicates

Modified: trunk/compilers/pct/src/POST/Node.pir
==============================================================================
--- trunk/compilers/pct/src/POST/Node.pir	Wed Oct 28 09:25:44 2009	(r42155)
+++ trunk/compilers/pct/src/POST/Node.pir	Wed Oct 28 13:45:58 2009	(r42156)
@@ -31,6 +31,7 @@
     $P0[4] = "    .param pmc %0 :named(%1)"
     $P0[5] = "    .param pmc %0 :optional :named(%1)\n    .param int has_%0 :opt_flag"
     $P0[6] = "    .param pmc %0 :slurpy :named"
+    $P0[8] = "    .param pmc %0 :call_sig"
     set_hll_global ['POST';'Sub'], '%!paramfmt', $P0
     .return ()
 .end
@@ -241,11 +242,12 @@
     .param pmc pname
     .param pmc adverbs         :slurpy :named
 
-    .local int optional, slurpy
+    .local int optional, slurpy, call_sig
     .local string named
     optional = adverbs['optional']
     slurpy = adverbs['slurpy']
     named = adverbs['named']
+    call_sig = adverbs['call_sig']
 
     .local int paramseq
     paramseq = isne optional, 0
@@ -255,6 +257,9 @@
     unless named goto named_done
     paramseq += 4
   named_done:
+    unless call_sig goto call_sig_done
+    paramseq += 8
+  call_sig_done:
 
     .local pmc paramlist
     paramlist = self['paramlist']


More information about the parrot-commits mailing list