X-Git-Url: http://git.megacz.com/?p=org.ibex.js.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FJS.java;h=a7270482ea2ed6e323f2abf7ab18ae9d48dc23c2;hp=9cf36df923d9f8f43306dc3ca867f373f6da4387;hb=aaf060ff38871512d80f1bbf04a6596648b284c7;hpb=1a4ec86fbdf1ea0aef1bd57f3fee162e03a5e279 diff --git a/src/org/ibex/js/JS.java b/src/org/ibex/js/JS.java index 9cf36df..a727048 100644 --- a/src/org/ibex/js/JS.java +++ b/src/org/ibex/js/JS.java @@ -41,9 +41,6 @@ public interface JS extends Pausable { * This function must never return a null object. */ public String[] getFormalArgs(); - /** Returns true if the specific key is found in this object. */ - public boolean hasKey(JS key); - /** Put a value to the given key, calling any write traps that have * been placed on the key. * @@ -92,16 +89,15 @@ public interface JS extends Pausable { public InputStream getInputStream() throws IOException, JSExn { throw new JSExn( "object has not associated stream, class ["+ getClass().getName() +"]"); } - public boolean hasKey(JS key) { return false; } - public Object run(Object o) throws Exception { throw new JSExn( "object cannot be called, class ["+ getClass().getName() +"]"); } public void pause() { throw new NotPausableException(); } - public JS call(JS[] args) throws JSExn { throw new JSExn( - "object cannot be called, class ["+ getClass().getName() +"]"); } - public JS call(JS method, JS[] args) throws JSExn { throw new JSExn( - "method not found: " + JSU.str(method)); } + public JS call(JS[] args) throws JSExn { throw new JSExn( "object cannot be called, class ["+ getClass().getName() +"]"); } + public JS call(JS method, JS[] args) throws JSExn { + if (method == null) return call(args); + throw new JSExn("method not found: " + JSU.str(method) + " class="+this.getClass().getName()); + } public String[] getFormalArgs() { return emptystr; } public void declare(JS key) throws JSExn { throw new JSExn( @@ -149,8 +145,6 @@ public interface JS extends Pausable { public JS call(JS[] a) throws JSExn { return clonee.call(a); } public String[] getFormalArgs() { return clonee.getFormalArgs(); } - public boolean hasKey(JS k) { return clonee.hasKey(k); } - public JS putAndTriggerTraps(JS k, JS v) throws JSExn { return clonee.putAndTriggerTraps(k, v); } public JS getAndTriggerTraps(JS k) throws JSExn { @@ -219,7 +213,6 @@ public interface JS extends Pausable { if (val == null) entries[dest + 1] = holder; else entries[dest + 1] = val; } - public boolean hasKey(JS key) { return indexOf(key) >= 0; } /*public boolean hasValue(JS key, JS value) { int i = indexOf(key); return i >= 0 && entries[i + 1] != null; } public boolean hasTrap(JS key, JS trap) {