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

Unified Diff: runtime/lib/growable_array.dart

Issue 10960011: Made removeAt errors consistent between dart2js and VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 3 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 | « lib/core/list.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index abdbb9d4959258209678f6b858f8049ebe32c66f..eaf538b4d7885121a93404e034ce74fae1242966 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -8,14 +8,16 @@ class GrowableObjectArray<T> implements List<T> {
"GrowableObjectArray can only be allocated by the VM");
}
- E removeAt(int index) {
- E result = this[index];
+ T removeAt(int index) {
+ if (index is! int) throw new IllegalArgumentException(index);
+ T result = this[index];
+ int newLength = this.length - 1;
Arrays.copy(this,
index + 1,
this,
index,
- this.length - index - 1);
- this.length = this.length - 1;
+ newLength - index);
+ this.length = newLength;
return result;
}
« no previous file with comments | « lib/core/list.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698