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

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

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use insertBefore and add is-check. Created 7 years, 9 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/_collection_dev/list.dart
diff --git a/sdk/lib/_collection_dev/list.dart b/sdk/lib/_collection_dev/list.dart
index 9685fda673a1ecf8d6ce2203af4342eb4bfce38b..19142a97e5e5e418644c5617f8c002cb217fa9e2 100644
--- a/sdk/lib/_collection_dev/list.dart
+++ b/sdk/lib/_collection_dev/list.dart
@@ -90,6 +90,11 @@ abstract class FixedLengthListBase<E> extends ListBase<E> {
"Cannot add to a fixed-length list");
}
+ void insert(int index, E value) {
+ throw new UnsupportedError(
+ "Cannot add to a fixed-length list");
+ }
+
void addAll(Iterable<E> iterable) {
throw new UnsupportedError(
"Cannot add to a fixed-length list");
@@ -171,6 +176,11 @@ abstract class UnmodifiableListBase<E> extends ListBase<E> {
"Cannot add to an unmodifiable list");
}
+ E insert(int index, E value) {
+ throw new UnsupportedError(
+ "Cannot add to an unmodifiable list");
+ }
+
void addAll(Iterable<E> iterable) {
throw new UnsupportedError(
"Cannot add to an unmodifiable list");
@@ -277,7 +287,9 @@ class _ListIndicesIterable extends ListIterable<int> {
int get length => _backedList.length;
int elementAt(int index) {
- if (index < 0 || index >= length) throw new RangeError(index);
+ if (index < 0 || index >= length) {
+ throw new RangeError.range(index, 0, length);
+ }
return index;
}
}
« no previous file with comments | « samples/swarm/swarm_ui_lib/observable/observable.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698