bugfix
authoradam <adam@megacz.com>
Mon, 11 Apr 2005 07:06:14 +0000 (07:06 +0000)
committeradam <adam@megacz.com>
Mon, 11 Apr 2005 07:06:14 +0000 (07:06 +0000)
darcs-hash:20050411070614-5007d-945fe96e5c400053a5809d889c39127746f66b2b.gz

src/org/ibex/js/JSArray.java

index 1ddb33f..e8529c6 100644 (file)
@@ -51,7 +51,8 @@ public class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
             "arrays only support positive integer keys, can not use: "+JSU.str(key));
         int i = ((JSNumber.I)key).toInt();
         if (i < 0) throw new JSExn("arrays can not use negative integer keys "+i);
-        size(i + 1); while (size() < i) add(null);
+        if (size() < i+1) size(i + 1);
+       //while (size() < i) add(null);
         set(i, val);
     }
 
@@ -85,7 +86,7 @@ public class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
 
     public void addTrap(JS k, JS f) throws JSExn { throw new JSExn("arrays do not support traps"); }
     public void delTrap(JS k, JS f) throws JSExn { throw new JSExn("arrays do not support traps"); }
-    public JS.Trap getTrap(JS k) throws JSExn { throw new JSExn("arrays do not support traps"); }
+    public JS.Trap getTrap(JS k) throws JSExn { return null; }
 
     /** FEATURE: move to specialised ArrayStore superclass. */
     public void addAll(JS[] entries) { for (int i=0; i < entries.length; i++) add(entries[i]); }