X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FInterpreter.java;h=b5becd03287aaae0e251f84adfed5ae96930c688;hp=359b844a9c51c1027d5e053b19061f8b98151aa2;hb=16c24a73c1c1b2955db0bbbaf5a940215329bca1;hpb=b2ef3378d07c929042d4f6b0df415912c5c8942b diff --git a/src/org/xwt/js/Interpreter.java b/src/org/xwt/js/Interpreter.java index 359b844..b5becd0 100644 --- a/src/org/xwt/js/Interpreter.java +++ b/src/org/xwt/js/Interpreter.java @@ -389,24 +389,27 @@ class Interpreter implements ByteCodes, Tokens { break; } + case ADD_TRAP: case DEL_TRAP: { + Object val = stack.pop(); + Object key = stack.pop(); + Object obj = stack.peek(); + // A trap addition/removal + JS js = obj instanceof JSScope ? ((JSScope)obj).top() : (JS) obj; + if(op == ADD_TRAP) js.addTrap(key, (JSFunction)val); + else js.delTrap(key, (JSFunction)val); + break; + } + case ASSIGN_SUB: case ASSIGN_ADD: { Object val = stack.pop(); Object key = stack.pop(); Object obj = stack.peek(); - if (val instanceof JSFunction && obj instanceof JS) { - // A trap addition/removal - JS js = obj instanceof JSScope ? ((JSScope)obj).top() : (JS) obj; - if(op == ASSIGN_ADD) js.addTrap(key, (JSFunction)val); - else js.delTrap(key, (JSFunction)val); - pc += ((Integer)arg).intValue() - 1; - } else { - // The following setup is VERY important. The generated bytecode depends on the stack - // being setup like this (top to bottom) KEY, OBJ, VAL, KEY, OBJ - stack.push(key); - stack.push(val); - stack.push(obj); - stack.push(key); - } + // The following setup is VERY important. The generated bytecode depends on the stack + // being setup like this (top to bottom) KEY, OBJ, VAL, KEY, OBJ + stack.push(key); + stack.push(val); + stack.push(obj); + stack.push(key); break; }