Author: pmichaud
Date: Thu Feb 21 09:37:24 2008
New Revision: 25936

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

Log:
[pct]:
* Fix 'callmethod' nodes so that they coerce the invocant into a
  PMC instead of sometimes using a constant.
* Resolves RT#51052, reported by Tene++ and Andy++ .


Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir   (original)
+++ trunk/compilers/pct/src/PAST/Compiler.pir   Thu Feb 21 09:37:24 2008
@@ -452,16 +452,30 @@
     .param pmc node
     .param pmc options         :slurpy :named
 
+    .local string pasttype
+    pasttype = node.'pasttype'()
+    if pasttype goto have_pasttype
+    pasttype = 'call'
+  have_pasttype:
+
+    .local string signature
+    signature = ':'
+    unless pasttype == 'callmethod' goto have_signature
+    signature = 'P:'
+  have_signature:
+
     .local pmc ops, posargs, namedargs
     .local string name
     name = node.'name'()
     unless name goto call_first_arg
-    (ops, posargs, namedargs) = self.'post_children'(node, 'signature'=>'v:')
+    signature = concat 'v', signature
+    (ops, posargs, namedargs) = self.'post_children'(node, 
'signature'=>signature)
     name = ops.'escape'(name)
     unshift posargs, name
     goto children_done
   call_first_arg:
-    (ops, posargs, namedargs) = self.'post_children'(node, 'signature'=>'vP:')
+    signature = concat 'vP', signature
+    (ops, posargs, namedargs) = self.'post_children'(node, 
'signature'=>signature)
   children_done:
 
     .local string result, rtype
@@ -472,11 +486,6 @@
     ops.'result'(result)
   result_done:
 
-    .local string pasttype
-    pasttype = node.'pasttype'()
-    if pasttype goto have_pasttype
-    pasttype = 'call'
-  have_pasttype:
     ops.'push_pirop'(pasttype, posargs :flat, namedargs :flat, 
'result'=>result)
     .return (ops)
 .end

Reply via email to