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

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: 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: 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 caa6b4c0dd3b048ba70d1cb55be8ea53d62e179b..a3d3cf37925a2241450cd6b8c14f6b6cc6966803 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
@@ -165,16 +165,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