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)) { |