Index: sdk/lib/_internal/compiler/js_lib/js_array.dart |
diff --git a/sdk/lib/_internal/compiler/js_lib/js_array.dart b/sdk/lib/_internal/compiler/js_lib/js_array.dart |
index 7283f21f667f81e6943acb950095d8aa851e1d08..d706b7512780c72e7bc400f4396d384557c79c05 100644 |
--- a/sdk/lib/_internal/compiler/js_lib/js_array.dart |
+++ b/sdk/lib/_internal/compiler/js_lib/js_array.dart |
@@ -575,28 +575,21 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable { |
void set length(int newLength) { |
checkGrowable('set length'); |
- if (newLength is !int) { |
- throw new ArgumentError.value(newLength, 'newLength'); |
- } |
- // TODO(sra): Remove this test and let JavaScript throw an error. |
- if (newLength < 0) { |
- throw new RangeError.range(newLength, 0, null, 'newLength'); |
- } |
- // JavaScript with throw a RangeError for numbers that are too big. The |
- // message does not contain the value. |
+ if (newLength is !int) throw new ArgumentError(newLength); |
+ if (newLength < 0) throw new RangeError.value(newLength); |
JS('void', r'#.length = #', this, newLength); |
} |
E operator [](int index) { |
- if (index is !int) throw diagnoseIndexError(this, index); |
- if (index >= length || index < 0) throw diagnoseIndexError(this, index); |
+ if (index is !int) throw new ArgumentError(index); |
+ if (index >= length || index < 0) throw new RangeError.value(index); |
return JS('var', '#[#]', this, index); |
} |
void operator []=(int index, E value) { |
checkMutable('indexed set'); |
- if (index is !int) throw diagnoseIndexError(this, index); |
- if (index >= length || index < 0) throw diagnoseIndexError(this, index); |
+ if (index is !int) throw new ArgumentError(index); |
+ if (index >= length || index < 0) throw new RangeError.value(index); |
JS('void', r'#[#] = #', this, index, value); |
} |