2003/11/03 05:28:30
[org.ibex.core.git] / src / org / xwt / Box.java.pp
index 7f8f46e..473d049 100644 (file)
@@ -517,28 +517,28 @@ public final class Box extends JS.Scope {
      *  INVARIANT: after completion, getChild(min(i, numChildren())) == newnode
      *  WARNING: O(n) runtime, unless i == numChildren()
      */
-    public void put(int i, Object value, TailCall tail) {
-        if (i < 0) return;
+    public Object put(int i, Object value) {
+        if (i < 0) return null;
         Trap t = value == null ? (Trap)get("childremoved", Trap.class) : (Trap)get("childadded", Trap.class);
             
         if (value != null && !(value instanceof Box)) {
             if (Log.on) Log.logJS(this, "attempt to set a numerical property on a box to a non-box");
-            return;
+            return null;
         }
 
         if (redirect == null) {
-            if (t != null) t.perform(value, tail);
+            if (t != null) return t.perform(value);
             else if (Log.on) Log.logJS(this, "attempt to add/remove children to/from a node with a null redirect");
         } else if (redirect != this) {
             Box b = value == null ? (Box)redirect.get(i) : (Box)value;
             // FIXME: what if both of them want a tailcall?
-            redirect.put(i, value, tail);
-            if (t != null) t.perform(value, tail);
+            redirect.put(i, value);
+            if (t != null) return t.perform(value);
         } else if (value == null) {
             if (i >= 0 && i < numChildren()) {
                 Box b = getChild(i);
                 b.remove();
-                if (t != null) t.perform(b, tail);
+                if (t != null) return t.perform(b);
             }
         } else {
             Box newnode = (Box)value;
@@ -547,7 +547,7 @@ public final class Box extends JS.Scope {
             for(Box cur = newnode.parent; cur != null; cur = cur.parent)
                 if (cur.redirect == newnode) {
                     if (Log.on) Log.logJS(this, "attempt to move a box that is the target of a redirect");
-                    return;
+                    return null;
                 }
 
             // check for recursive ancestor violation
@@ -555,7 +555,7 @@ public final class Box extends JS.Scope {
                 if (cur == newnode) {
                     if (Log.on) Log.logJS(this, "attempt to make a node a parent of its own ancestor");
                     if (Log.on) Log.log(this, "box == " + this + "  ancestor == " + newnode);
-                    return;
+                    return null;
                 }
 
             if (numKids > 15 && children == null) convert_to_array();
@@ -600,8 +600,9 @@ public final class Box extends JS.Scope {
             MARK_FOR_REFLOW_this;
             
             newnode.dirty();
-            if (t != null) t.perform(b, tail);
+            if (t != null) return t.perform(b);
         }
+        return null;
     }
     
     public Object get(Object key, Object key2) { return super.get(key, key2); }
@@ -647,21 +648,20 @@ public final class Box extends JS.Scope {
      *  @param rp if this put is being performed via a root proxy, rp is the root proxy.
      */
     public void put_(Object name, Object value) { super.put(name, value); }
-    public void put(Object name, Object value) { put(name, value, null, false); }  // FIXME: correct?
-    public void put(Object name, Object value, TailCall tail) { put(name, value, tail, false); }
-    public void put(Object name_, Object value, TailCall tail, boolean ignoretraps) {
-        if (name_ instanceof Number) { put(((Number)name_).intValue(), value, tail); }
-        if (!(name_ instanceof String)) { super.put(name_,value); return; }
+    public Object put(Object name, Object value) { return put(name, value, false); }
+    public Object put(Object name_, Object value,  boolean ignoretraps) {
+        if (name_ instanceof Number) { return put(((Number)name_).intValue(), value); }
+        if (!(name_ instanceof String)) { return super.put(name_,value); }
         String name = name_.toString();
         if (!ignoretraps) {
             Trap t = (Trap)get(name, Trap.class);
-            if (t != null) { t.perform(value, tail); return; }
+            if (t != null) return t.perform(value);
         }
 
         SpecialBoxProperty gph = (SpecialBoxProperty)SpecialBoxProperty.specialBoxProperties.get(name);
-        if (gph != null) { gph.put(name, this, value); return; }
+        if (gph != null) { gph.put(name, this, value); return null; }
 
-        super.put(name, value);
+        return super.put(name, value);
     }