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:_internal/compiler/js_lib/shared/async_await_error_codes.dart' | 10 import 'package:_internal/compiler/js_lib/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 '../util/util.dart'; | 15 import '../util/util.dart'; |
16 import '../dart2jslib.dart' show DiagnosticListener; | 16 import '../dart2jslib.dart' show DiagnosticListener; |
17 | 17 |
18 import "../helpers/helpers.dart"; | |
19 | |
20 /// Rewrites a [js.Fun] with async/sync*/async* functions and await and yield | 18 /// Rewrites a [js.Fun] with async/sync*/async* functions and await and yield |
21 /// (with dart-like semantics) to an equivalent function without these. | 19 /// (with dart-like semantics) to an equivalent function without these. |
22 /// await-for is not handled and must be rewritten before. (Currently handled | 20 /// await-for is not handled and must be rewritten before. (Currently handled |
23 /// in ssa/builder.dart). | 21 /// in ssa/builder.dart). |
24 /// | 22 /// |
25 /// When generating the input to this, special care must be taken that | 23 /// When generating the input to this, special care must be taken that |
26 /// parameters to sync* functions that are mutated in the body must be boxed. | 24 /// parameters to sync* functions that are mutated in the body must be boxed. |
27 /// (Currently handled in closure.dart). | 25 /// (Currently handled in closure.dart). |
28 /// | 26 /// |
29 /// Look at [visitFun], [visitDartYield] and [visitAwait] for more explanation. | 27 /// Look at [visitFun], [visitDartYield] and [visitAwait] for more explanation. |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 return condition || body; | 2572 return condition || body; |
2575 } | 2573 } |
2576 | 2574 |
2577 @override | 2575 @override |
2578 bool visitDartYield(js.DartYield node) { | 2576 bool visitDartYield(js.DartYield node) { |
2579 hasYield = true; | 2577 hasYield = true; |
2580 visit(node.expression); | 2578 visit(node.expression); |
2581 return true; | 2579 return true; |
2582 } | 2580 } |
2583 } | 2581 } |
OLD | NEW |