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

Unified Diff: runtime/lib/array.dart

Issue 10905010: Some code cleanups in arrays, fix rangeCheck (issue 2899). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
===================================================================
--- runtime/lib/array.dart (revision 11570)
+++ runtime/lib/array.dart (working copy)
@@ -48,7 +48,7 @@
List<E> getRange(int start, int length) {
if (length == 0) return [];
Arrays.rangeCheck(this, start, length);
- List list = new List<E>();
+ List list = new GrowableObjectArray<E>.withCapacity(length);
list.length = length;
Arrays.copy(this, start, list, 0, length);
return list;
@@ -66,8 +66,7 @@
return Collections.map(this, new GrowableObjectArray.withCapacity(length), f);
}
- Dynamic reduce(Dynamic initialValue,
- Dynamic combine(Dynamic previousValue, E element)) {
+ reduce(initialValue, combine(previousValue, E element)) {
return Collections.reduce(this, initialValue, combine);
}
@@ -203,8 +202,7 @@
return Collections.map(this, new GrowableObjectArray.withCapacity(length), f);
}
- Dynamic reduce(Dynamic initialValue,
- Dynamic combine(Dynamic previousValue, E element)) {
+ reduce(initialValue, combine(previousValue, E element)) {
return Collections.reduce(this, initialValue, combine);
}

Powered by Google App Engine
This is Rietveld 408576698