fixed bugs 495 and 499
authoradam <adam@megacz.com>
Tue, 16 Mar 2004 04:14:49 +0000 (04:14 +0000)
committeradam <adam@megacz.com>
Tue, 16 Mar 2004 04:14:49 +0000 (04:14 +0000)
darcs-hash:20040316041449-5007d-21be67e06a661bbba9565a5a5bdb622059bd8e18.gz

src/org/ibex/Box.java
src/org/ibex/js/Interpreter.java

index 0e5d2a7..6f618c1 100644 (file)
@@ -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 "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);
         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);
index 6cbaf23..92b29a4 100644 (file)
@@ -245,6 +245,11 @@ class Interpreter implements ByteCodes, Tokens {
                     }
                 }
                 if (t != null) {
                     }
                 }
                 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;
                     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);
                         }
                         } else {
                             t = ((JS)o).getTrap(v);
                         }
-
                         while (t != null && t.f.numFormalArgs != 0) t = t.next; // get first read trap
                         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) {
                     }
                     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;
                         f = t.f;
                         scope = new Trap.TrapScope(f.parentScope, t, null);
                         ((Trap.TrapScope)scope).cascadeHappened = true;