OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library _js_helper; | 5 library _js_helper; |
6 | 6 |
7 import 'dart:_async_await_error_codes' as async_error_codes; | 7 import 'dart:_async_await_error_codes' as async_error_codes; |
8 | 8 |
9 import 'dart:_js_embedded_names' show | 9 import 'dart:_js_embedded_names' show |
10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1428 } | 1428 } |
1429 | 1429 |
1430 throwRuntimeError(message) { | 1430 throwRuntimeError(message) { |
1431 throw new RuntimeError(message); | 1431 throw new RuntimeError(message); |
1432 } | 1432 } |
1433 | 1433 |
1434 throwAbstractClassInstantiationError(className) { | 1434 throwAbstractClassInstantiationError(className) { |
1435 throw new AbstractClassInstantiationError(className); | 1435 throw new AbstractClassInstantiationError(className); |
1436 } | 1436 } |
1437 | 1437 |
1438 throwConcurrentModificationError(collection) { | 1438 // Can be called |
1439 throw new ConcurrentModificationError(collection); | 1439 // |
1440 // throwConcurrentModificationError(a.length == startLength, a) | |
1441 // | |
1442 // or | |
1443 // | |
1444 // s.length == startLength || throwConcurrentModificationError(a) | |
1445 // | |
1446 @NoInline() @NoSideEffects() | |
1447 throwConcurrentModificationError(sameLength, [collection]) { | |
floitsch
2015/04/16 19:22:53
I would prefer a separate function which you then
sra1
2015/04/16 23:37:24
Done.
| |
1448 if (collection == null) { | |
1449 collection = sameLength; | |
1450 sameLength = false; | |
1451 } | |
1452 if (true != sameLength) { | |
1453 throw new ConcurrentModificationError(collection); | |
1454 } | |
1440 } | 1455 } |
1441 | 1456 |
1442 /** | 1457 /** |
1443 * Helper class for building patterns recognizing native type errors. | 1458 * Helper class for building patterns recognizing native type errors. |
1444 */ | 1459 */ |
1445 class TypeErrorDecoder { | 1460 class TypeErrorDecoder { |
1446 // Field names are private to help tree-shaking. | 1461 // Field names are private to help tree-shaking. |
1447 | 1462 |
1448 /// A regular expression which matches is matched against an error message. | 1463 /// A regular expression which matches is matched against an error message. |
1449 final String _pattern; | 1464 final String _pattern; |
(...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3979 // This is a function that will return a helper function that does the | 3994 // This is a function that will return a helper function that does the |
3980 // iteration of the sync*. | 3995 // iteration of the sync*. |
3981 // | 3996 // |
3982 // Each invocation should give a body with fresh state. | 3997 // Each invocation should give a body with fresh state. |
3983 final dynamic /* js function */ _outerHelper; | 3998 final dynamic /* js function */ _outerHelper; |
3984 | 3999 |
3985 SyncStarIterable(this._outerHelper); | 4000 SyncStarIterable(this._outerHelper); |
3986 | 4001 |
3987 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); | 4002 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); |
3988 } | 4003 } |
OLD | NEW |