| Index: runtime/lib/array_patch.dart
|
| ===================================================================
|
| --- runtime/lib/array_patch.dart (revision 16730)
|
| +++ runtime/lib/array_patch.dart (working copy)
|
| @@ -7,7 +7,7 @@
|
| // fixed size array.
|
| patch class List<E> {
|
| /* patch */ factory List([int length = 0]) {
|
| - if (length is! int || length < 0) {
|
| + if ((length is! int) || (length < 0)) {
|
| throw new ArgumentError("Length must be a positive integer: $length.");
|
| }
|
| _GrowableObjectArray<E> result = new _GrowableObjectArray<E>();
|
| @@ -16,7 +16,7 @@
|
| }
|
|
|
| /* patch */ factory List.fixedLength(int length, {E fill: null}) {
|
| - if (length is! int || length < 0) {
|
| + if ((length is! int) || (length < 0)) {
|
| throw new ArgumentError("Length must be a positive integer: $length.");
|
| }
|
| _ObjectArray<E> result = new _ObjectArray<E>(length);
|
| @@ -29,17 +29,15 @@
|
| }
|
|
|
| /* patch */ factory List.filled(int length, E fill) {
|
| - if (length is! int || length < 0) {
|
| + if ((length is! int) || (length < 0)) {
|
| throw new ArgumentError("Length must be a positive integer: $length.");
|
| }
|
| _GrowableObjectArray<E> result =
|
| new _GrowableObjectArray<E>.withCapacity(length < 4 ? 4 : length);
|
| - if (length != 0) {
|
| - result.length = length;
|
| - if (fill != null) {
|
| - for (int i = 0; i < length; i++) {
|
| - result[i] = fill;
|
| - }
|
| + result.length = length;
|
| + if (fill != null) {
|
| + for (int i = 0; i < length; i++) {
|
| + result[i] = fill;
|
| }
|
| }
|
| return result;
|
|
|