From 4c2d51015dcd304759b31bd0835ae85cd4cf7aab Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 16 Mar 2004 04:14:49 +0000 Subject: [PATCH] fixed bugs 495 and 499 darcs-hash:20040316041449-5007d-21be67e06a661bbba9565a5a5bdb622059bd8e18.gz --- src/org/ibex/Box.java | 8 +++++++- src/org/ibex/js/Interpreter.java | 14 ++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 0e5d2a7..6f618c1 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -557,7 +557,13 @@ public final class Box extends JSScope implements Scheduler.Task { case "Minimized": if (parent == null && getSurface() != null) getSurface().minimized = toBoolean(value); // FEATURE case "Maximized": if (parent == null && getSurface() != null) getSurface().maximized = toBoolean(value); // FEATURE case "Close": if (parent == null && getSurface() != null) getSurface().dispose(true); - case "redirect": if (redirect == this) redirect = (Box)value; else Log.info(this, "redirect can only be set once"); + case "redirect": + for(Box cur = (Box)value; cur != null; cur = cur.parent) + if (cur == redirect) { + redirect = (Box)value; + return; + } + JS.error("redirect can only be set to a descendant of its current value"); case "font": if(!(value instanceof Stream)) throw new JSExn("You can only put streams to the font property"); font = value == null ? null : Font.getFont((Stream)value, font == null ? 10 : font.pointsize); diff --git a/src/org/ibex/js/Interpreter.java b/src/org/ibex/js/Interpreter.java index 6cbaf23..92b29a4 100644 --- a/src/org/ibex/js/Interpreter.java +++ b/src/org/ibex/js/Interpreter.java @@ -245,6 +245,11 @@ class Interpreter implements ByteCodes, Tokens { } } if (t != null) { + stack.pop(); + stack.push(new CallMarker(this)); + stack.push(target); + JSArray args = new JSArray(); + args.addElement(val); f = t.f; scope = new Trap.TrapScope(f.parentScope, t, val); pc = -1; @@ -289,15 +294,12 @@ class Interpreter implements ByteCodes, Tokens { } else { t = ((JS)o).getTrap(v); } - while (t != null && t.f.numFormalArgs != 0) t = t.next; // get first read trap - if (t != null) { - stack.push(new CallMarker(this)); - JSArray args = new JSArray(); - stack.push(args); - } } if (t != null) { + stack.push(new CallMarker(this)); + JSArray args = new JSArray(); + stack.push(args); f = t.f; scope = new Trap.TrapScope(f.parentScope, t, null); ((Trap.TrapScope)scope).cascadeHappened = true; -- 1.7.10.4