[pypy-commit] lang-js default: defer function name resolving in case of exception

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:32:52 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r154:32aaba0ea927
Date: 2011-11-09 13:52 +0100
http://bitbucket.org/pypy/lang-js/changeset/32aaba0ea927/

Log:	defer function name resolving in case of exception

diff --git a/js/opcodes.py b/js/opcodes.py
--- a/js/opcodes.py
+++ b/js/opcodes.py
@@ -484,12 +484,12 @@
 
 def common_call(ctx, r1, args, this, name):
     if not isinstance(r1, W_PrimitiveObject):
-        raise ThrowException(W_String("%s is not a callable (%s)"%(r1.ToString(), name)))
+        raise ThrowException(W_String("%s is not a callable (%s)"%(r1.ToString(), name.ToString())))
     jit.promote(r1)
     try:
         res = r1.Call(args.tolist(), this)
     except JsTypeError:
-        raise ThrowException(W_String("%s is not a function (%s)"%(r1.ToString(), name)))
+        raise ThrowException(W_String("%s is not a function (%s)"%(r1.ToString(), name.ToString())))
     return res
 
 class CALL(Opcode):
@@ -497,10 +497,9 @@
     def eval(self, ctx):
         r1 = ctx.pop()
         args = ctx.pop()
-        name = r1.ToString()
         this = ctx.to_context_object()
         #XXX hack, this should be comming from context
-        ctx.append(common_call(ctx, r1, args, this, name))
+        ctx.append(common_call(ctx, r1, args, this, r1))
 
 class CALL_METHOD(Opcode):
     _stack_change = -2
@@ -510,7 +509,7 @@
         args = ctx.pop()
         name = method.ToString()
         r1 = what.Get(name)
-        ctx.append(common_call(ctx, r1, args, what, name))
+        ctx.append(common_call(ctx, r1, args, what, method))
 
 class DUP(Opcode):
     def eval(self, ctx):


More information about the pypy-commit mailing list