From: megacz Date: Fri, 30 Jan 2004 07:01:50 +0000 (+0000) Subject: 2003/06/18 06:22:49 X-Git-Tag: RC3~865 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=1a8dcf7794ae435c5c2811b8d7c2b75832047595 2003/06/18 06:22:49 darcs-hash:20040130070150-2ba56-87313055632092e8358dc9437335ca557e4e479d.gz --- diff --git a/src/org/xwt/Trap.java b/src/org/xwt/Trap.java index e836ba2..bb32ee4 100644 --- a/src/org/xwt/Trap.java +++ b/src/org/xwt/Trap.java @@ -15,6 +15,22 @@ public class Trap { // Static Data ////////////////////////////////////////////////////////////// + /** the arguments.cascade() function */ + public static final JS.Callable cascadeFunction = new JS.Callable() { + public Object call(JS.Array args) { + Trap currentTrap = TrapContext.get().currentTrap; + if (args.length() != 0) TrapContext.get().putCascadeHappened = true; + Trap t = currentTrap.next; + // if we've hit the end of the trap stack, just do a put(,,,true) + if (t == null) { + if (args.length() == 0) return currentTrap.trapee.get(currentTrap.name, true); + currentTrap.trapee.put(currentTrap.name, args.elementAt(0), true); + return null; + } + return t.perform(args); + } + }; + /** a vector of weak references to all instances of Trap; used for retheming */ private static Hashtable allTraps = new Hashtable(1000); @@ -118,22 +134,6 @@ public class Trap { return null; } - /** Called by Rhino's arguments.cascade. Note: cx will be null if this was invoked from perform() rather than from a script. */ - public static final JS.Callable cascadeFunction = new JS.Callable() { - public Object call(JS.Array args) { - Trap currentTrap = TrapContext.get().currentTrap; - if (args.length() != 0) TrapContext.get().putCascadeHappened = true; - Trap t = currentTrap.next; - // if we've hit the end of the trap stack, just do a put(,,,true) - if (t == null) { - if (args.length() == 0) return currentTrap.trapee.get(currentTrap.name, true); - currentTrap.trapee.put(currentTrap.name, args.elementAt(0), true); - return null; - } - return t.perform(args); - } - }; - /** called by Rhino's arguments.trapee hack */ public static Object currentTrapee() { Trap current = TrapContext.get().currentTrap; diff --git a/src/org/xwt/js/JS.java b/src/org/xwt/js/JS.java index 6e80511..b89b61c 100644 --- a/src/org/xwt/js/JS.java +++ b/src/org/xwt/js/JS.java @@ -92,6 +92,8 @@ public abstract class JS { public Object elementAt(int i) { return super.elementAt(i); } public void addElement(Object o) { super.addElement(o); } public void setElementAt(Object o, int i) { super.setElementAt(o, i); } + public Object get(Object key) { return super.get(key); } + public void put(Object key, Object val) { super.put(key, val); } } /** Any object which becomes part of the scope chain must support this interface */