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

Unified Diff: runtime/lib/growable_array.dart

Issue 790873002: Minor optimization in _GrowableList.removeAt. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « no previous file | no next file » | 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 455f7657e0e44fc4dfc840150fd7c764f438899f..a5724759fd936775089067be659783b0f789282f 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -25,7 +25,9 @@ class _GrowableList<T> extends ListBase<T> {
T removeAt(int index) {
var result = this[index];
int newLength = this.length - 1;
- Lists.copy(this, index + 1, this, index, newLength - index);
+ if (index < newLength) {
+ Lists.copy(this, index + 1, this, index, newLength - index);
+ }
this.length = newLength;
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698