[svn:parrot] r39385 - branches/pmc_pct/compilers/pmcc/src

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Jun 4 12:58:52 UTC 2009


Author: bacek
Date: Thu Jun  4 12:58:51 2009
New Revision: 39385
URL: https://trac.parrot.org/parrot/changeset/39385

Log:
Implement add_multi in PMC.

Modified:
   branches/pmc_pct/compilers/pmcc/src/nodes.pir

Modified: branches/pmc_pct/compilers/pmcc/src/nodes.pir
==============================================================================
--- branches/pmc_pct/compilers/pmcc/src/nodes.pir	Thu Jun  4 12:58:27 2009	(r39384)
+++ branches/pmc_pct/compilers/pmcc/src/nodes.pir	Thu Jun  4 12:58:51 2009	(r39385)
@@ -50,6 +50,10 @@
     $P1 = new 'Hash'
     res.'attr'('methods', $P1, 1)
 
+    # Multis are Hash of Arrays. name -> implementation*
+    $P1 = new 'Hash'
+    res.'attr'('multis', $P1, 1)
+
     $P1 = new 'ResizablePMCArray'
     res.'attr'('attrs', $P1, 1)
 
@@ -99,6 +103,16 @@
     .tailcall self.'attr'('methods',0,0)
 .end
 
+=item C<multis>
+
+Get PMC MULTIs.
+
+=cut
+
+.sub 'multis' :method
+    .tailcall self.'attr'('multis',0,0)
+.end
+
 =item C<provides>
 
 Get PMC provided interfaces.
@@ -271,6 +285,28 @@
     .return ()
 .end
 
+=item C<add_multi>
+
+Add MULTI to PMC.
+
+=cut
+
+.sub 'add_multi' :method
+    .param string name
+    .param pmc    multi
+
+    .local pmc    list
+
+    $P0 = self.'attr'('multis', 0, 0)
+    list = $P0[name]
+    unless null list goto vivify
+    list = new ['ResizablePMCArray']
+    $P0[name] = list
+  vivify:
+    push list, multi
+    .return ()
+.end
+
 =item C<add_attr>
 
 Add an ATTR to PMC.


More information about the parrot-commits mailing list