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

Unified Diff: runtime/lib/array.dart

Issue 14175013: Add setAll, insertAll, replaceRange and fillRange. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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: runtime/lib/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index bd736aac4c03b9bed726fa8bbbf23c9f1628ee7d..1ebc5b7cfd826627c4453fda8089edc8b8910544 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -29,6 +29,15 @@ class _ObjectArray<E> implements List<E> {
"Cannot add to a non-extendable array");
}
+ void insertAll(int index, Iterable<E> iterable) {
+ throw new UnsupportedError(
+ "Cannot add to a non-extendable array");
+ }
+
+ void setAll(int index, Iterable<E> iterable) {
+ IterableMixinWorkaround.setAllList(this, index, iterable);
+ }
+
E removeAt(int index) {
throw new UnsupportedError(
"Cannot remove element of a non-extendable array");
@@ -86,6 +95,15 @@ class _ObjectArray<E> implements List<E> {
"Cannot remove range of a non-extendable array");
}
+ void replaceRange(int start, int end, Iterable<E> iterable) {
+ throw new UnsupportedError(
+ "Cannot remove range of a non-extendable array");
+ }
+
+ void fillRange(int start, int end, [E fillValue]) {
+ IterableMixinWorkaround.fillRangeList(this, start, end, fillValue);
+ }
+
List<E> sublist(int start, [int end]) {
Arrays.indicesCheck(this, start, end);
if (end == null) end = this.length;
@@ -277,6 +295,16 @@ class _ImmutableArray<E> implements List<E> {
"Cannot add to an immutable array");
}
+ void insertAll(int index, Iterable<E> iterable) {
+ throw new UnsupportedError(
+ "Cannot add to an immutable array");
+ }
+
+ void setAll(int index, Iterable<E> iterable) {
+ throw new UnsupportedError(
+ "Cannot modify an immutable array");
+ }
+
E removeAt(int index) {
throw new UnsupportedError(
"Cannot modify an immutable array");
@@ -312,6 +340,16 @@ class _ImmutableArray<E> implements List<E> {
"Cannot remove range of an immutable array");
}
+ void fillRange(int start, int end, [E fillValue]) {
+ throw new UnsupportedError(
+ "Cannot modify an immutable array");
+ }
+
+ void replaceRange(int start, int end, Iterable<E> iterable) {
+ throw new UnsupportedError(
+ "Cannot modify an immutable array");
+ }
+
List<E> sublist(int start, [int end]) {
Arrays.indicesCheck(this, start, end);
if (end == null) end = this.length;

Powered by Google App Engine
This is Rietveld 408576698