Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_array.dart

Issue 1294483003: Revert "Make List constructor give better error messages for non-int arguments" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/symbols.h ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/js_array.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_array.dart b/sdk/lib/_internal/js_runtime/lib/js_array.dart
index 51a8fb4dc1ee4eb3eeac3bff547ed79dace4ab5e..f6bcbbbe6d382bdd4a1e136d6ff73bc0fa84b918 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_array.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_array.dart
@@ -22,14 +22,8 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
factory JSArray.fixed(int length) {
// Explicit type test is necessary to guard against JavaScript conversions
// in unchecked mode.
- if (length is !int) {
- throw new ArgumentError.value(length, "length", "is not an integer");
- }
- // The JavaScript Array constructor with one argument throws if
- // the value is not a UInt32. Give a better error message.
- int maxJSArrayLength = 0xFFFFFFFF;
- if (length < 0 || length > maxJSArrayLength) {
- throw new RangeError.range(length, 0, maxJSArrayLength, "length");
+ if ((length is !int) || (length < 0)) {
+ throw new ArgumentError("Length must be a non-negative integer: $length");
}
return new JSArray<E>.markFixed(JS('', 'new Array(#)', length));
}
@@ -214,10 +208,8 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
}
void addAll(Iterable<E> collection) {
- int i = this.length;
checkGrowable('addAll');
for (E e in collection) {
- assert(i++ == this.length || (throw new ConcurrentModificationError(this)));
JS('void', r'#.push(#)', this, e);
}
}
« no previous file with comments | « runtime/vm/symbols.h ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698