| Index: compiler/lib/implementation/array.js
|
| diff --git a/compiler/lib/implementation/array.js b/compiler/lib/implementation/array.js
|
| index a6b1abe17ac15cfd3a6f7b81a6a94f9ef38b1046..667160715e0bbff19b8cac25645e8b31848dd8c7 100644
|
| --- a/compiler/lib/implementation/array.js
|
| +++ b/compiler/lib/implementation/array.js
|
| @@ -8,12 +8,24 @@ function native_ListFactory__new(typeToken, length) {
|
| Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs));
|
| }
|
|
|
| -function native_ListImplementation__indexOperator(index) {
|
| - return this[index];
|
| +function native_ListImplementation_INDEX(index) {
|
| + var i = index | 0;
|
| + if (i !== index) {
|
| + native__NumberJsUtil__throwIllegalArgumentException(index);
|
| + } else if (i < 0 || i >= this.length) {
|
| + native__ListJsUtil__throwIndexOutOfRangeException(index);
|
| + }
|
| + return this[i];
|
| }
|
|
|
| -function native_ListImplementation__indexAssignOperator(index, value) {
|
| - this[index] = value;
|
| +function native_ListImplementation_ASSIGN_INDEX(index, value) {
|
| + var i = index | 0;
|
| + if (i !== index) {
|
| + native__NumberJsUtil__throwIllegalArgumentException(index);
|
| + } else if (i < 0 || i >= this.length) {
|
| + native__ListJsUtil__throwIndexOutOfRangeException(index);
|
| + }
|
| + this[i] = value;
|
| }
|
|
|
| function native_ListImplementation_get$length() {
|
| @@ -28,13 +40,6 @@ function native_ListImplementation__add(element) {
|
| this.push(element);
|
| }
|
|
|
| -function $inlineArrayIndexCheck(array, index) {
|
| - if (index >= 0 && index < array.length) {
|
| - return index;
|
| - }
|
| - native__ListJsUtil__throwIndexOutOfRangeException(index);
|
| -}
|
| -
|
| function native_ListImplementation__removeRange(start, length) {
|
| this.splice(start, length);
|
| }
|
| @@ -46,3 +51,13 @@ function native_ListImplementation__insertRange(start, length, initialValue) {
|
| }
|
| this.splice.apply(this, array);
|
| }
|
| +
|
| +function $inlineArrayIndexCheck(array, index) {
|
| + var i = index | 0;
|
| + if (i !== index) {
|
| + native__NumberJsUtil__throwIllegalArgumentException(index);
|
| + } else if (i < 0 || i >= array.length) {
|
| + native__ListJsUtil__throwIndexOutOfRangeException(index);
|
| + }
|
| + return i;
|
| +}
|
|
|