Chromium Code Reviews| Index: runtime/lib/array_patch.dart |
| diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart |
| index f8343941905d1ddb2c5d28e186722763f1c4d648..db4626a9ed3a3794311e1062020250dd0be78df6 100644 |
| --- a/runtime/lib/array_patch.dart |
| +++ b/runtime/lib/array_patch.dart |
| @@ -11,14 +11,7 @@ class _GrowableArrayMarker implements int { |
| const _GROWABLE_ARRAY_MARKER = const _GrowableArrayMarker(); |
| @patch class List<E> { |
| - @patch factory List([int length = _GROWABLE_ARRAY_MARKER]) { |
| - if (identical(length, _GROWABLE_ARRAY_MARKER)) { |
| - return new _GrowableList<E>(0); |
| - } |
| - // All error handling on the length parameter is done at the implementation |
| - // of new _List. |
| - return new _List<E>(length); |
| - } |
| + @patch factory List([int length]) = List<E>._internal; |
|
Kevin Millikin (Google)
2017/01/04 15:31:04
Patch files can't change the default value (it's n
|
| @patch factory List.filled(int length, E fill, {bool growable: false}) { |
| // All error handling on the length parameter is done at the implementation |
| @@ -59,6 +52,17 @@ const _GROWABLE_ARRAY_MARKER = const _GrowableArrayMarker(); |
| return makeFixedListUnmodifiable(result); |
| } |
| + // The List factory constructor redirects to this one so that we can change |
| + // length's default value from the one in the SDK's implementation. |
| + factory List._internal([int length = _GROWABLE_ARRAY_MARKER]) { |
| + if (identical(length, _GROWABLE_ARRAY_MARKER)) { |
| + return new _GrowableList<E>(0); |
| + } |
| + // All error handling on the length parameter is done at the implementation |
| + // of new _List. |
| + return new _List<E>(length); |
| + } |
| + |
| // Factory constructing a mutable List from a parser generated List literal. |
| // [elements] contains elements that are already type checked. |
| factory List._fromLiteral(List elements) { |