X-Git-Url: http://git.megacz.com/?p=org.ibex.js.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FJSArray.java;fp=src%2Forg%2Fibex%2Fjs%2FJSArray.java;h=e8529c6d1b9b215eb8231a0a87f0afceb8ddffd0;hp=1ddb33fab96be65ec6449f60d48f3dbd9d051b8f;hb=36b48aab36d33bd862a9ce81ac69f57fd0a94484;hpb=1da9851e5aa0c1aa6063847a4a7f3f874266af3a diff --git a/src/org/ibex/js/JSArray.java b/src/org/ibex/js/JSArray.java index 1ddb33f..e8529c6 100644 --- a/src/org/ibex/js/JSArray.java +++ b/src/org/ibex/js/JSArray.java @@ -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]); }