OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 rewrite_async; | 5 library rewrite_async; |
6 | 6 |
7 import "dart:math" show max; | 7 import "dart:math" show max; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:js_runtime/shared/async_await_error_codes.dart' | 10 import 'package:js_runtime/shared/async_await_error_codes.dart' |
11 as error_codes; | 11 as error_codes; |
12 | 12 |
13 import "js.dart" as js; | 13 import "js.dart" as js; |
14 | 14 |
15 import '../diagnostic_listener.dart'; | 15 import '../diagnostic_listener.dart'; |
16 import '../util/util.dart'; | 16 import '../diagnostics/spannable.dart' show |
| 17 NO_LOCATION_SPANNABLE, |
| 18 Spannable; |
| 19 import '../util/util.dart' show |
| 20 Pair; |
17 | 21 |
18 /// Rewrites a [js.Fun] with async/sync*/async* functions and await and yield | 22 /// Rewrites a [js.Fun] with async/sync*/async* functions and await and yield |
19 /// (with dart-like semantics) to an equivalent function without these. | 23 /// (with dart-like semantics) to an equivalent function without these. |
20 /// await-for is not handled and must be rewritten before. (Currently handled | 24 /// await-for is not handled and must be rewritten before. (Currently handled |
21 /// in ssa/builder.dart). | 25 /// in ssa/builder.dart). |
22 /// | 26 /// |
23 /// When generating the input to this, special care must be taken that | 27 /// When generating the input to this, special care must be taken that |
24 /// parameters to sync* functions that are mutated in the body must be boxed. | 28 /// parameters to sync* functions that are mutated in the body must be boxed. |
25 /// (Currently handled in closure.dart). | 29 /// (Currently handled in closure.dart). |
26 /// | 30 /// |
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 return condition || body; | 2589 return condition || body; |
2586 } | 2590 } |
2587 | 2591 |
2588 @override | 2592 @override |
2589 bool visitDartYield(js.DartYield node) { | 2593 bool visitDartYield(js.DartYield node) { |
2590 hasYield = true; | 2594 hasYield = true; |
2591 visit(node.expression); | 2595 visit(node.expression); |
2592 return true; | 2596 return true; |
2593 } | 2597 } |
2594 } | 2598 } |
OLD | NEW |