remove JS.hasKey(); it is extremely important that foo.bar
authoradam <adam@megacz.com>
Mon, 10 Jan 2005 02:47:33 +0000 (02:47 +0000)
committeradam <adam@megacz.com>
Mon, 10 Jan 2005 02:47:33 +0000 (02:47 +0000)
darcs-hash:20050110024733-5007d-8f78144d5b3f16ccd7ae858eecbda61410df7e08.gz

src/org/ibex/js/JS.java
src/org/ibex/js/JSArray.java

index 9cf36df..a338311 100644 (file)
@@ -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,8 +89,6 @@ 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(); }
@@ -149,8 +144,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 +212,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) {
index fc862d5..9124761 100644 (file)
@@ -59,12 +59,6 @@ public class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
     public String[] getFormalArgs() { return empty; }
     public String coerceToString() { return "array"; } // FIXME
 
-    public boolean hasKey(JS key) {
-        if (key == null || !(key instanceof JSNumber.I)) return false;
-        int i = ((JSNumber.I)key).toInt();
-        return 0 <= i && i < size();
-    }
-
     public Object run(Object o) throws JSExn { return call(null); }
     public void pause() throws NotPausableException { throw new NotPausableException(); }
     public JS call(JS[] args) throws JSExn { throw new JSExn("can not call an array as a function"); }