From 36b48aab36d33bd862a9ce81ac69f57fd0a94484 Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 11 Apr 2005 07:06:14 +0000 Subject: [PATCH] bugfix darcs-hash:20050411070614-5007d-945fe96e5c400053a5809d889c39127746f66b2b.gz --- src/org/ibex/js/JSArray.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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]); } -- 1.7.10.4