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

Unified Diff: runtime/lib/array_patch.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 10 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_patch.dart
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index da5bf73839a3c447543a694c44f5e367c7f9e662..635b46075ed57c784eef6a5ccea6a4cdda30ca76 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -6,15 +6,16 @@
// returns a _GrowableObjectArray if length is null, otherwise returns
// fixed size array.
patch class List<E> {
- /* patch */ factory List([int length = 0]) {
+ /* patch */ factory List([int length]) {
+ if (!?length) return new _GrowableObjectArray<E>(0);
if ((length is! int) || (length < 0)) {
Ivan Posva 2013/02/27 18:14:36 Why do we still do manual type checking here?
floitsch 2013/02/28 09:41:58 1) because we didn't go through code to remove che
_throwArgumentError(length);
}
- _GrowableObjectArray<E> result = new _GrowableObjectArray<E>(length);
+ _ObjectArray<E> result = new _ObjectArray<E>(length);
return result;
}
- /* patch */ factory List.fixedLength(int length, {E fill: null}) {
+ /* patch */ factory List.filled(int length, E fill) {
if ((length is! int) || (length < 0)) {
_throwArgumentError(length);
}

Powered by Google App Engine
This is Rietveld 408576698