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

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

Issue 1056353004: Add List.unmodifiable constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove left-over debug coide. Created 5 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/internal/list.dart
diff --git a/sdk/lib/internal/list.dart b/sdk/lib/internal/list.dart
index 6b94c6cbbf9197b3a135d78eedbbe90ae15fa1c0..8fe02c4736e75334939e0ba7844735bd1961157d 100644
--- a/sdk/lib/internal/list.dart
+++ b/sdk/lib/internal/list.dart
@@ -374,3 +374,19 @@ abstract class NonGrowableListError {
* state.
*/
external List makeListFixedLength(List growableList);
+
+/**
+ * Converts a fixed-length list to an unmodifiable list.
+ *
+ * For internal use only.
+ * Only works for core fixed-length lists as created by `new List(length)`,
+ * or as returned by [makeListFixedLength].
+ *
+ * The operation is efficient. It doesn't copy the elements, but converts
+ * the existing list directly to a fixed length list.
+ * That means that it is a destructive conversion.
+ * The original list should not be used afterwards.
+ *
+ * The unmodifialbe list type is similar to the one used by const lists.
sra1 2015/04/22 21:17:31 spelling
+ */
+external List makeFixedListUnmodifiable(List fixedLengthList);

Powered by Google App Engine
This is Rietveld 408576698