X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fibex%2Fjs%2FInterpreter.java;h=14f0f19899581397787f5f3bde5e08c914604208;hb=da1f843588c8bd2b2c7cc74a5b4ffff8d57ab712;hp=ce83f696fc22df44cdfcbdf20768327ac173b3b0;hpb=b1a58aeb4adfade0697650583ec5801fa6e88d5e;p=org.ibex.core.git diff --git a/src/org/ibex/js/Interpreter.java b/src/org/ibex/js/Interpreter.java index ce83f69..14f0f19 100644 --- a/src/org/ibex/js/Interpreter.java +++ b/src/org/ibex/js/Interpreter.java @@ -217,10 +217,22 @@ class Interpreter implements ByteCodes, Tokens { throw je("tried to assign \"" + (val==null?"(null)":val.toString()) + "\" to the null key"); Trap t = null; - if (target instanceof Trap.TrapScope && key.equals("cascade")) { - Trap.TrapScope ts = (Trap.TrapScope)target; - t = ts.t.next; - ts.cascadeHappened = true; + if (target instanceof JSScope && key.equals("cascade")) { + Trap.TrapScope ts = null; + JSScope p = (JSScope)target; // search the scope-path for the trap + if (target instanceof Trap.TrapScope) { + ts = (Trap.TrapScope)target; + } + else { + while (ts == null && p.getParentScope() != null) { + p = p.getParentScope(); + if (p instanceof Trap.TrapScope) { + ts = (Trap.TrapScope)p; + } + } + } + t = ts.t.next; + ts.cascadeHappened = true; while (t != null && t.f.numFormalArgs == 0) t = t.next; if (t == null) { target = ts.t.trapee; key = ts.t.name; }