| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 kernel.transformations.continuation; | 5 library kernel.transformations.continuation; |
| 6 | 6 |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 | 8 |
| 9 import '../ast.dart'; | 9 import '../ast.dart'; |
| 10 import '../core_types.dart'; | 10 import '../core_types.dart'; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 enclosingFunction.body.parent = enclosingFunction; | 148 enclosingFunction.body.parent = enclosingFunction; |
| 149 enclosingFunction.asyncMarker = AsyncMarker.Sync; | 149 enclosingFunction.asyncMarker = AsyncMarker.Sync; |
| 150 return enclosingFunction; | 150 return enclosingFunction; |
| 151 } | 151 } |
| 152 | 152 |
| 153 Statement buildClosureBody() { | 153 Statement buildClosureBody() { |
| 154 // The body will insert calls to | 154 // The body will insert calls to |
| 155 // :iterator.current_= | 155 // :iterator.current_= |
| 156 // :iterator.isYieldEach= | 156 // :iterator.isYieldEach= |
| 157 // and return `true` as long as it did something and `false` when it's done. | 157 // and return `true` as long as it did something and `false` when it's done. |
| 158 return new Block([ | 158 return new Block(<Statement>[ |
| 159 enclosingFunction.body.accept(this), | 159 enclosingFunction.body.accept(this), |
| 160 new ReturnStatement(new BoolLiteral(false)) | 160 new ReturnStatement(new BoolLiteral(false)) |
| 161 ]); | 161 ]); |
| 162 } | 162 } |
| 163 | 163 |
| 164 visitYieldStatement(YieldStatement node) { | 164 visitYieldStatement(YieldStatement node) { |
| 165 var transformedExpression = node.expression.accept(this); | 165 var transformedExpression = node.expression.accept(this); |
| 166 | 166 |
| 167 var statements = <Statement>[]; | 167 var statements = <Statement>[]; |
| 168 if (node.isYieldStar) { | 168 if (node.isYieldStar) { |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 findConstructor(syncIterableClass, ''), | 970 findConstructor(syncIterableClass, ''), |
| 971 findConstructor(streamIteratorClass, ''), | 971 findConstructor(streamIteratorClass, ''), |
| 972 findFactoryConstructor(futureClass, 'microtask'), | 972 findFactoryConstructor(futureClass, 'microtask'), |
| 973 findConstructor(streamControllerClass, ''), | 973 findConstructor(streamControllerClass, ''), |
| 974 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), | 974 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), |
| 975 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), | 975 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), |
| 976 findProcedure(asyncLibrary, '_awaitHelper'), | 976 findProcedure(asyncLibrary, '_awaitHelper'), |
| 977 new CoreTypes(program)); | 977 new CoreTypes(program)); |
| 978 } | 978 } |
| 979 } | 979 } |
| OLD | NEW |