changes made after tupshins reconstruction
[org.ibex.core.git] / src / org / xwt / js / Interpreter.java
index 359b844..b5becd0 100644 (file)
@@ -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;
             }