| Index: runtime/lib/array_patch.dart
|
| ===================================================================
|
| --- runtime/lib/array_patch.dart (revision 16756)
|
| +++ runtime/lib/array_patch.dart (working copy)
|
| @@ -8,16 +8,15 @@
|
| patch class List<E> {
|
| /* patch */ factory List([int length = 0]) {
|
| if ((length is! int) || (length < 0)) {
|
| - throw new ArgumentError("Length must be a positive integer: $length.");
|
| + _throwArgumentError(length);
|
| }
|
| - _GrowableObjectArray<E> result = new _GrowableObjectArray<E>();
|
| - result.length = length;
|
| + _GrowableObjectArray<E> result = new _GrowableObjectArray<E>(length);
|
| return result;
|
| }
|
|
|
| /* 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.");
|
| + _throwArgumentError(length);
|
| }
|
| _ObjectArray<E> result = new _ObjectArray<E>(length);
|
| if (fill != null) {
|
| @@ -30,7 +29,7 @@
|
|
|
| /* patch */ factory List.filled(int length, E fill) {
|
| if ((length is! int) || (length < 0)) {
|
| - throw new ArgumentError("Length must be a positive integer: $length.");
|
| + _throwArgumentError(length);
|
| }
|
| _GrowableObjectArray<E> result =
|
| new _GrowableObjectArray<E>.withCapacity(length < 4 ? 4 : length);
|
| @@ -53,4 +52,8 @@
|
| }
|
| return list;
|
| }
|
| +
|
| + static void _throwArgumentError(int length) {
|
| + throw new ArgumentError("Length must be a positive integer: $length.");
|
| + }
|
| }
|
|
|