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 d706b7512780c72e7bc400f4396d384557c79c05..e30e1068d0e913d00fe47107591c880e304e7d3b 100644 |
--- a/sdk/lib/_internal/compiler/js_lib/js_array.dart |
+++ b/sdk/lib/_internal/compiler/js_lib/js_array.dart |
@@ -575,21 +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(newLength); |
+ if (newLength is !int) throw new ArgumentError.value(newLength); |
Lasse Reichstein Nielsen
2015/06/12 14:24:36
consider passing "newLength" as second argument.
sra1
2015/06/12 22:29:04
Done.
|
if (newLength < 0) throw new RangeError.value(newLength); |
Lasse Reichstein Nielsen
2015/06/12 14:24:36
Consider using new RangeError.range(newLength, 0,
sra1
2015/06/12 22:29:05
I have done this for now.
The error feels wordy a
|
JS('void', r'#.length = #', this, newLength); |
} |
E operator [](int index) { |
- if (index is !int) throw new ArgumentError(index); |
- if (index >= length || index < 0) throw new RangeError.value(index); |
+ if (index is !int) throw diagnoseIndexError(this, index); |
+ if (index >= length || index < 0) throw diagnoseIndexError(this, index); |
return JS('var', '#[#]', this, index); |
} |
void operator []=(int index, E value) { |
checkMutable('indexed set'); |
- if (index is !int) throw new ArgumentError(index); |
- if (index >= length || index < 0) throw new RangeError.value(index); |
+ if (index is !int) throw diagnoseIndexError(this, index); |
+ if (index >= length || index < 0) throw diagnoseIndexError(this, index); |
JS('void', r'#[#] = #', this, index, value); |
} |