public final void replaceNode(int index, Object o) { bt().replaceNode(index,o); }
public final int indexNode(Object o) { return bt().indexNode(o); }
}
-
- // FEATURE: JS.StringKeys
- /* public static StringKeys extends JS {
- public JS get(JS key) { return JS.isString(key) ? get(JS.toString(key) : null; }
- ...
- */
-
+
JS _unclone() { return this; }
public interface Cloneable { }
public final JS nextElement() throws JSExn { return !done ? _nextElement() : parent != null ? parent.nextElement() : null; }
public JS get(JS key) throws JSExn {
- //#switch(JS.toString(key))
+ //#jswitch(key)
case "hasMoreElements": return B(hasMoreElements());
case "nextElement": return nextElement();
//#end
/** performs a put, triggering traps if present; traps are run in an unpauseable interpreter */
public void putAndTriggerTraps(JS key, JS value) throws JSExn {
Trap t = getTrap(key);
- throw new Error("FIXME");
- /*if (t != null) t.invoke(value);
- elese put(key, value);*/
+ if(t == null || (t = t.writeTrap()) == null) put(key,value);
+ else new Interpreter(t,value,false).resume();
}
/** performs a get, triggering traps if present; traps are run in an unpauseable interpreter */
public JS getAndTriggerTraps(JS key) throws JSExn {
Trap t = getTrap(key);
- throw new Error("FIXME");
- /*if (t != null) return t.invoke();
- else return get(key);*/
+ if (t == null || (t = t.readTrap()) == null) return get(key);
+ else return new Interpreter(t,null,false).resume();
+ }
+
+ public JS justTriggerTraps(JS key, JS value) throws JSExn {
+ Trap t = getTrap(key);
+ if(t == null || (t = t.writeTrap()) == null) return value;
+ else return new Interpreter(t,value,true).resume();
}
/** adds a trap, avoiding duplicates */