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

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

Issue 14468004: Fix missing concurrency check in [].forEach. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added comment about iteration order of lists. Created 7 years, 8 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
Index: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index b7978ff4852c361b8e69d9d89a0ce5288f1ecc4b..0b62f2ad23c3cac275a409e76193d3a27517c154 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -33,6 +33,18 @@ part of dart.core;
* unmodifiableList.length = 0; // throws.
* unmodifiableList.add(499); // throws
* unmodifiableList[0] = 87; // throws.
+ *
+ * Lists are [Iterable].
+ * List iteration iterates over values in index order.
+ * Changing the values will not affect iteration,
+ * but changing the valid indices -
+ * that is, changing the list's length -
+ * between iteration steps
+ * will cause a [ConcurrentModificationError].
+ * This means that only growable lists can throw [ConcurrentModificationError].
+ * If the length changes temporarily
+ * and is restored before continuing the iteration,
+ * the iterator will not detect it.
hausner 2013/04/25 23:07:17 Right. So why add the check?
*/
abstract class List<E> implements Iterable<E> {
/**

Powered by Google App Engine
This is Rietveld 408576698