Chromium Code Reviews| Index: sdk/lib/internal/iterable.dart |
| diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart |
| index 7f6b8917f357d088185aa4d462b139c42d46dd43..36c39cae5c8e7b248865e50a52a688407f994bde 100644 |
| --- a/sdk/lib/internal/iterable.dart |
| +++ b/sdk/lib/internal/iterable.dart |
| @@ -587,11 +587,15 @@ class SkipIterable<E> extends Iterable<E> { |
| return new SkipIterable<E>._(iterable, count); |
| } |
| - SkipIterable._(this._iterable, this._skipCount) { |
| - if (_skipCount is! int) { |
| - throw new ArgumentError.value(_skipCount, "count is not an integer"); |
| + SkipIterable._(this._iterable, int skipCount) |
| + : _skipCount = _checkSkip(skipCount); |
|
Lasse Reichstein Nielsen
2017/04/28 06:25:23
How about inlining the check:
: _skipCount = ((s
sra1
2017/04/28 18:38:36
The trouble with combined conditions (&&, ||) is t
|
| + |
| + static int _checkSkip(int skipCount) { |
|
Lasse Reichstein Nielsen
2017/04/28 06:25:23
If not inlined, maybe name this _checkCount and re
sra1
2017/04/28 18:38:37
Done.
|
| + if (skipCount is! int) { |
| + throw new ArgumentError.value(skipCount, "count is not an integer"); |
|
Lasse Reichstein Nielsen
2017/04/28 06:25:23
Second argument is the argument name, not a messag
sra1
2017/04/28 18:38:36
Acknowledged.
|
| } |
| - RangeError.checkNotNegative(_skipCount, "count"); |
| + RangeError.checkNotNegative(skipCount, "count"); |
|
Lasse Reichstein Nielsen
2017/04/28 06:25:23
Could we combine the two:
if (skipCount is! int |
sra1
2017/04/28 18:38:37
See above. dart2js does much better at understandi
Lasse Reichstein Nielsen
2017/05/01 05:32:00
I'm a little concerned about writing code to match
|
| + return skipCount; |
| } |
| Iterable<E> skip(int count) { |