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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/core_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: 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: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
index fad1d02b36521240804297b072f1d242b4f8fb80..daaa30dbe7a2e196e8ac51c155fcf32b3ac48482 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
@@ -166,16 +166,17 @@ patch class Stopwatch {
// Patch for List implementation.
patch class List<E> {
- patch factory List([int length = 0]) {
- // Explicit type test is necessary to protect Primitives.newGrowableList in
+ patch factory List([int length]) {
+ if (!?length) return Primitives.newGrowableList(0);
+ // Explicit type test is necessary to protect Primitives.newFixedList in
// unchecked mode.
if ((length is !int) || (length < 0)) {
throw new ArgumentError("Length must be a positive integer: $length.");
}
- return Primitives.newGrowableList(length);
+ return Primitives.newFixedList(length);
}
- patch factory List.fixedLength(int length, {E fill: null}) {
+ patch factory List.filled(int length, E fill) {
// Explicit type test is necessary to protect Primitives.newFixedList in
// unchecked mode.
if ((length is !int) || (length < 0)) {

Powered by Google App Engine
This is Rietveld 408576698