X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FCompiledFunctionImpl.java;h=87c527c171006bf68e2f5caca687e5feefb82de7;hb=d1db5780c2fe79cf7acaa71508358d410aec7b96;hp=9fe5435cc5dd7f9965c632c8cb9e52e7a3e15c89;hpb=a81a151e639664cb340cf3726f9e8b9c77d125fb;p=org.ibex.core.git diff --git a/src/org/xwt/js/CompiledFunctionImpl.java b/src/org/xwt/js/CompiledFunctionImpl.java index 9fe5435..87c527c 100644 --- a/src/org/xwt/js/CompiledFunctionImpl.java +++ b/src/org/xwt/js/CompiledFunctionImpl.java @@ -77,7 +77,8 @@ class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens { Object ret = cx.stack.pop(); if (cx.stack.size() > size) // this should never happen - throw new Error("ERROR: stack grew by " + (cx.stack.size() - size) + " elements during call at " + sourceName + ":" + firstLine); + throw new Error("ERROR: stack grew by " + (cx.stack.size() - size) + + " elements during call at " + sourceName + ":" + firstLine); return ret; } catch(Error e) { // Unwind the stack @@ -331,20 +332,26 @@ class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens { Object old = t.pop(); Object key = t.pop(); Object obj = t.peek(); - if (obj instanceof org.xwt.Box && val instanceof CompiledFunction) { - if (curOP == ASSIGN_ADD) { - ((org.xwt.Box)obj).addTrap(key, val); - } else { - ((org.xwt.Box)obj).delTrap(key, val); + if (val instanceof CompiledFunction) { + if (obj instanceof JS.Scope) { + JS.Scope parent = (JS.Scope)obj; + while(parent.getParentScope() != null) parent = parent.getParentScope(); + if (parent instanceof org.xwt.Box) { + if (curOP == ASSIGN_ADD) { + ((org.xwt.Box)parent).addTrap(key, val); + } else { + ((org.xwt.Box)parent).delTrap(key, val); + } + // skip over the "normal" implementation of +=/-= + pc += ((Integer)arg[pc]).intValue() - 1; + break; + } } - // skip over the "normal" implementation of +=/-= - pc += ((Integer)arg[pc]).intValue() - 1; - } else { - // use the "normal" implementation - t.push(key); - t.push(old); - t.push(arg); } + // use the "normal" implementation + t.push(key); + t.push(old); + t.push(arg); break; }