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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_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: sdk/lib/_internal/compiler/implementation/lib/js_array.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_array.dart b/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
index b82e58afaeda320e485a2d4a031feac6468f326a..ca0121023bfcd4a72404812291d3062c69eb269b 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
@@ -36,6 +36,16 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
JS('void', r'#.splice(#, 0, #)', this, index, value);
}
+ void insertAll(int index, Iterable<E> iterable) {
+ checkGrowable(this, 'insertAll');
+ IterableMixinWorkaround.insertAllList(this, index, iterable);
+ }
+
+ void setAll(int index, Iterable<E> iterable) {
+ checkMutable(this, 'setAll');
+ IterableMixinWorkaround.setAllList(this, index, iterable);
+ }
+
E removeLast() {
checkGrowable(this, 'removeLast');
if (length == 0) throw new RangeError.value(-1);
@@ -198,6 +208,16 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
IterableMixinWorkaround.setRangeList(this, start, end, iterable, skipCount);
}
+ void fillRange(int start, int end, [E fillValue]) {
+ checkMutable(this, 'fill range');
+ IterableMixinWorkaround.fillRangeList(this, start, end, fillValue);
+ }
+
+ void replaceRange(int start, int end, Iterable<E> iterable) {
+ checkGrowable(this, 'removeRange');
+ IterableMixinWorkaround.replaceRangeList(this, start, end, iterable);
+ }
+
bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f);
bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f);

Powered by Google App Engine
This is Rietveld 408576698