| 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 // This is used in open coded for-in loops on arrays. |
| 1439 // |
| 1440 // checkConcurrentModificationError(a.length == startLength, a) |
| 1441 // |
| 1442 // is replaced in codegen by: |
| 1443 // |
| 1444 // a.length == startLength || throwConcurrentModificationError(a) |
| 1445 // |
| 1446 // TODO(sra): We would like to annotate this as @NoSideEffects() so that loops |
| 1447 // with no other effects can recognize that the array length does not |
| 1448 // change. However, in the usual case where the loop does have other effects, |
| 1449 // that causes the length in the loop condition to be phi(startLength,a.length), |
| 1450 // which causes confusion in range analysis and the insertion of a bounds check. |
| 1451 @NoInline() |
| 1452 checkConcurrentModificationError(sameLength, collection) { |
| 1453 if (true != sameLength) { |
| 1454 throwConcurrentModificationError(collection); |
| 1455 } |
| 1456 } |
| 1457 |
| 1458 @NoInline() |
| 1459 throwConcurrentModificationError(collection) { |
| 1460 throw new ConcurrentModificationError(collection); |
| 1461 } |
| 1438 | 1462 |
| 1439 /** | 1463 /** |
| 1440 * Helper class for building patterns recognizing native type errors. | 1464 * Helper class for building patterns recognizing native type errors. |
| 1441 */ | 1465 */ |
| 1442 class TypeErrorDecoder { | 1466 class TypeErrorDecoder { |
| 1443 // Field names are private to help tree-shaking. | 1467 // Field names are private to help tree-shaking. |
| 1444 | 1468 |
| 1445 /// A regular expression which matches is matched against an error message. | 1469 /// A regular expression which matches is matched against an error message. |
| 1446 final String _pattern; | 1470 final String _pattern; |
| 1447 | 1471 |
| (...skipping 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3976 // This is a function that will return a helper function that does the | 4000 // This is a function that will return a helper function that does the |
| 3977 // iteration of the sync*. | 4001 // iteration of the sync*. |
| 3978 // | 4002 // |
| 3979 // Each invocation should give a body with fresh state. | 4003 // Each invocation should give a body with fresh state. |
| 3980 final dynamic /* js function */ _outerHelper; | 4004 final dynamic /* js function */ _outerHelper; |
| 3981 | 4005 |
| 3982 SyncStarIterable(this._outerHelper); | 4006 SyncStarIterable(this._outerHelper); |
| 3983 | 4007 |
| 3984 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); | 4008 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); |
| 3985 } | 4009 } |
| OLD | NEW |