| 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' |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 inits.add(makeInit(completerName, new js.New(newCompleter, []))); | 841 inits.add(makeInit(completerName, new js.New(newCompleter, []))); |
| 842 } else if (isAsyncStar) { | 842 } else if (isAsyncStar) { |
| 843 inits.add(makeInit(controllerName, | 843 inits.add(makeInit(controllerName, |
| 844 new js.Call(newController, [new js.VariableUse(bodyName)]))); | 844 new js.Call(newController, [new js.VariableUse(bodyName)]))); |
| 845 } | 845 } |
| 846 inits.add(makeInit(handlerName, js.number(rethrowLabel))); | 846 inits.add(makeInit(handlerName, js.number(rethrowLabel))); |
| 847 inits.add(makeInit(currentErrorName, null)); | 847 inits.add(makeInit(currentErrorName, null)); |
| 848 if (hasJumpThroughFinally || analysis.hasYield) { | 848 if (hasJumpThroughFinally || analysis.hasYield) { |
| 849 inits.add(makeInit(nextName, null)); | 849 inits.add(makeInit(nextName, null)); |
| 850 } | 850 } |
| 851 if (isAsyncStar && analysis.hasYield) { |
| 852 inits.add(makeInit(nextWhenCanceledName, null)); |
| 853 } |
| 851 if (analysis.hasExplicitReturns && isAsync) { | 854 if (analysis.hasExplicitReturns && isAsync) { |
| 852 inits.add(makeInit(returnValueName, null)); | 855 inits.add(makeInit(returnValueName, null)); |
| 853 } | 856 } |
| 854 if (analysis.hasThis && !isSyncStar) { | 857 if (analysis.hasThis && !isSyncStar) { |
| 855 // Sync* functions must remember `this` on the level of the outer | 858 // Sync* functions must remember `this` on the level of the outer |
| 856 // function. | 859 // function. |
| 857 inits.add(makeInit(selfName, new js.This())); | 860 inits.add(makeInit(selfName, new js.This())); |
| 858 } | 861 } |
| 859 inits.addAll(localVariables.map((js.VariableDeclaration decl) { | 862 inits.addAll(localVariables.map((js.VariableDeclaration decl) { |
| 860 return new js.VariableInitialization(decl, null); | 863 return new js.VariableInitialization(decl, null); |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 return condition || body; | 2298 return condition || body; |
| 2296 } | 2299 } |
| 2297 | 2300 |
| 2298 @override | 2301 @override |
| 2299 bool visitDartYield(js.DartYield node) { | 2302 bool visitDartYield(js.DartYield node) { |
| 2300 hasYield = true; | 2303 hasYield = true; |
| 2301 visit(node.expression); | 2304 visit(node.expression); |
| 2302 return true; | 2305 return true; |
| 2303 } | 2306 } |
| 2304 } | 2307 } |
| OLD | NEW |