Chromium Code Reviews| Index: runtime/lib/typed_data.dart |
| diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart |
| index 8e5bcaa211b633fd6173301aea292ab875fd8226..f2164aa854ae714707980d583ce433ff672d1afc 100644 |
| --- a/runtime/lib/typed_data.dart |
| +++ b/runtime/lib/typed_data.dart |
| @@ -302,15 +302,15 @@ abstract class _TypedListBase { |
| } |
| dynamic fold(dynamic initialValue, |
| - dynamic combine(dynamic initialValue, element)) { |
| + dynamic combine(dynamic initialValue, element)) { |
|
Lasse Reichstein Nielsen
2013/05/29 07:44:18
Inconsistent use of dynamic: it should be on eleme
floitsch
2013/05/29 14:51:12
Changed to `num`. That works for ints and doubles.
|
| return IterableMixinWorkaround.fold(this, initialValue, combine); |
| } |
| - Iterable where(bool f(int element)) { |
| + Iterable where(bool f(element)) { |
| return IterableMixinWorkaround.where(this, f); |
| } |
| - Iterable expand(Iterable f(int element)) { |
| + Iterable expand(Iterable f(element)) { |
| return IterableMixinWorkaround.expand(this, f); |
| } |
| @@ -318,7 +318,7 @@ abstract class _TypedListBase { |
| return IterableMixinWorkaround.takeList(this, n); |
| } |
| - Iterable takeWhile(bool test(int value)) { |
| + Iterable takeWhile(bool test(value)) { |
|
Lasse Reichstein Nielsen
2013/05/29 07:44:18
value => element.
More below.
floitsch
2013/05/29 14:51:12
Done.
|
| return IterableMixinWorkaround.takeWhile(this, test); |
| } |
| @@ -326,7 +326,7 @@ abstract class _TypedListBase { |
| return IterableMixinWorkaround.skipList(this, n); |
| } |
| - Iterable skipWhile(bool test(int value)) { |
| + Iterable skipWhile(bool test(value)) { |
| return IterableMixinWorkaround.skipWhile(this, test); |
| } |
| @@ -338,19 +338,19 @@ abstract class _TypedListBase { |
| return IterableMixinWorkaround.any(this, f); |
| } |
| - int firstWhere(bool test(int value), {int orElse()}) { |
| + firstWhere(bool test(value), {orElse()}) { |
| return IterableMixinWorkaround.firstWhere(this, test, orElse); |
| } |
| - int lastWhere(bool test(int value), {int orElse()}) { |
| + lastWhere(bool test(value), {orElse()}) { |
| return IterableMixinWorkaround.lastWhereList(this, test, orElse); |
| } |
| - int singleWhere(bool test(int value)) { |
| + singleWhere(bool test(value)) { |
| return IterableMixinWorkaround.singleWhere(this, test); |
| } |
| - int elementAt(int index) { |
| + elementAt(int index) { |
| return this[index]; |
| } |
| @@ -428,27 +428,27 @@ abstract class _TypedListBase { |
| "Cannot remove from a non-extendable array"); |
| } |
| - void removeWhere(bool test(int element)) { |
| + void removeWhere(bool test(element)) { |
| throw new UnsupportedError( |
| "Cannot remove from a non-extendable array"); |
| } |
| - void retainWhere(bool test(int element)) { |
| + void retainWhere(bool test(element)) { |
| throw new UnsupportedError( |
| "Cannot remove from a non-extendable array"); |
| } |
| - int get first { |
| + get first { |
| if (length > 0) return this[0]; |
| throw new StateError("No elements"); |
| } |
| - int get last { |
| + get last { |
| if (length > 0) return this[length - 1]; |
| throw new StateError("No elements"); |
| } |
| - int get single { |
| + get single { |
| if (length == 1) return this[0]; |
| if (length == 0) throw new StateError("No elements"); |
| throw new StateError("More than one element"); |