| 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 f75c3d7998b56307202d4083157c04b84a5ecb0f..58e90165a07b9850d0a26e34773417167f6a6f2f 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
|
| @@ -155,7 +155,42 @@ patch class _StopwatchImpl {
|
|
|
| // Patch for List implementation.
|
| patch class _ListImpl<E> {
|
| - patch factory List([int length]) => Primitives.newList(length);
|
| + patch factory List([int length = 0]) {
|
| + if ((length is !int) || (length < 0)) {
|
| + throw new ArgumentError("Length must be a positive integer: $length.");
|
| + }
|
| + return Primitives.newGrowableList(length);
|
| + }
|
| +
|
| + patch factory List.fixedLength(int length, {E fill: null}) {
|
| + if ((length is !int) || (length < 0)) {
|
| + throw new ArgumentError("Length must be a positive integer: $length.");
|
| + }
|
| + List result = Primitives.newFixedList(length);
|
| + if (length != 0 && fill != null) {
|
| + for (int i = 0; i < result.length; i++) {
|
| + result[i] = fill;
|
| + }
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + /**
|
| + * Creates an extendable list of the given [length] where each entry is
|
| + * filled with [fill].
|
| + */
|
| + patch factory List.filled(int length, E fill) {
|
| + if ((length is !int) || (length < 0)) {
|
| + throw new ArgumentError("Length must be a positive integer: $length.");
|
| + }
|
| + List result = Primitives.newGrowableList(length);
|
| + if (length != 0 && fill != null) {
|
| + for (int i = 0; i < result.length; i++) {
|
| + result[i] = fill;
|
| + }
|
| + }
|
| + return result;
|
| + }
|
|
|
| patch factory List.from(Iterable<E> other) {
|
| var result = new List();
|
|
|