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

Unified Diff: sdk/lib/collection/list.dart

Issue 1214723009: Make List constructor give better error messages for non-int arguments (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Use unused variable. 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 | « sdk/lib/_internal/js_runtime/lib/js_array.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/list.dart
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 9b6b753a815db1dd3f729e54e021322f743bfc58..02e4b711e95b03c5db2549b6032849b01dd1980c 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -244,8 +244,12 @@ abstract class ListMixin<E> implements List<E> {
}
void addAll(Iterable<E> iterable) {
+ int i = this.length;
for (E element in iterable) {
- this[this.length++] = element;
+ assert(this.length == i || (throw new ConcurrentModificationError(this)));
+ this.length = i + 1;
+ this[i] = element;
+ i++;
}
}
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_array.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698