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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_array.dart

Issue 13956006: Remove insertRange. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebuild DOM (unrelated CL) and update status files. 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
« no previous file with comments | « sdk/lib/_collection_dev/list.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22f50182b060b21e4d162ad47d3f818b340c3dd4..b82e58afaeda320e485a2d4a031feac6468f326a 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_array.dart
@@ -160,34 +160,6 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
return IterableMixinWorkaround.getRangeList(this, start, end);
}
- void insertRange(int start, int length, [E initialValue]) {
- checkGrowable(this, 'insertRange');
- if (length == 0) {
- return;
- }
- if (length is !int) throw new ArgumentError(length);
- if (length < 0) throw new ArgumentError(length);
- if (start is !int) throw new ArgumentError(start);
-
- var receiver = this;
- var receiverLength = receiver.length;
- if (start < 0 || start > receiverLength) {
- throw new RangeError.value(start);
- }
- receiver.length = receiverLength + length;
- Arrays.copy(receiver,
- start,
- receiver,
- start + length,
- receiverLength - start);
- if (initialValue != null) {
- for (int i = start; i < start + length; i++) {
- receiver[i] = initialValue;
- }
- }
- receiver.length = receiverLength + length;
- }
-
E get first {
if (length > 0) return this[0];
throw new StateError("No elements");
@@ -204,29 +176,21 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
throw new StateError("More than one element");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int end) {
checkGrowable(this, 'removeRange');
- if (length == 0) {
- return;
- }
- checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
- checkNull(length); // TODO(ahe): This is not specified but co19 tests it.
- if (start is !int) throw new ArgumentError(start);
- if (length is !int) throw new ArgumentError(length);
- if (length < 0) throw new ArgumentError(length);
- var receiverLength = this.length;
- if (start < 0 || start >= receiverLength) {
- throw new RangeError.value(start);
+ int receiverLength = this.length;
+ if (start < 0 || start > receiverLength) {
+ throw new RangeError.range(start, 0, receiverLength);
}
- if (start + length > receiverLength) {
- throw new RangeError.value(start + length);
+ if (end < start || end > receiverLength) {
+ throw new RangeError.range(end, start, receiverLength);
}
Arrays.copy(this,
- start + length,
+ end,
this,
start,
- receiverLength - length - start);
- this.length = receiverLength - length;
+ receiverLength - end);
+ this.length = receiverLength - (end - start);
}
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
« no previous file with comments | « sdk/lib/_collection_dev/list.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698