[svn:parrot] r41890 - trunk/compilers/pct/src/PCT

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Fri Oct 16 21:49:06 UTC 2009


Author: pmichaud
Date: Fri Oct 16 21:49:04 2009
New Revision: 41890
URL: https://trac.parrot.org/parrot/changeset/41890

Log:
[pct]:  Generalize the types of nodes that PCT::Node.node() understands.

Modified:
   trunk/compilers/pct/src/PCT/Node.pir

Modified: trunk/compilers/pct/src/PCT/Node.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/Node.pir	Fri Oct 16 17:49:56 2009	(r41889)
+++ trunk/compilers/pct/src/PCT/Node.pir	Fri Oct 16 21:49:04 2009	(r41890)
@@ -204,11 +204,17 @@
     if $I0 goto node_match
     $I0 = isa node, ['PCT';'Node']
     if $I0 goto node_pct
-    $S0 = typeof node
-    $S0 = concat "Don't know how to save info from node of type ", $S0
-    die $S0
-  node_match:
+  node_misc:
+    $I0 = can node, 'orig'
+    unless $I0 goto err_unknown
+    $I0 = can node, 'from'
+    unless $I0 goto err_unknown
+    if $I0 goto node_misc
     .local pmc source, pos
+    source = node.'orig'()
+    pos = node.'from'()
+    goto node_done
+  node_match:
     source = getattribute node, '$.target'
     pos    = node.'from'()
     goto node_done
@@ -219,6 +225,12 @@
     self['source'] = source
     self['pos']    = pos
   done:
+    .return ()
+
+  err_unknown:
+    $S0 = typeof node
+    $S0 = concat "Don't know how to save info from node of type ", $S0
+    die $S0
 .end
 
 


More information about the parrot-commits mailing list