From 44ef8d82de0e921098345942a6a68bfb264df1e4 Mon Sep 17 00:00:00 2001 From: tupshin Date: Sun, 28 Mar 2004 02:00:31 +0000 Subject: [PATCH] fixed bug 506 darcs-hash:20040328020031-a9258-8176b9eb73e7f77982f0c735fc0e748bc5b2c39f.gz --- src/org/ibex/js/Interpreter.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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; } -- 1.7.10.4