| 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common/tasks.dart'; | 8 import '../common/tasks.dart'; |
| 9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
| 10 import '../world.dart'; | 10 import '../world.dart'; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 /// generation of a new (temporary) representation to store where variables need | 63 /// generation of a new (temporary) representation to store where variables need |
| 64 /// to be hoisted/captured up at another level to re-write the closure, and then | 64 /// to be hoisted/captured up at another level to re-write the closure, and then |
| 65 /// the code generation phase where we generate elements and/or instructions to | 65 /// the code generation phase where we generate elements and/or instructions to |
| 66 /// represent this new code path. | 66 /// represent this new code path. |
| 67 /// | 67 /// |
| 68 /// For a general explanation of how closure conversion works at a high level, | 68 /// For a general explanation of how closure conversion works at a high level, |
| 69 /// check out: | 69 /// check out: |
| 70 /// http://siek.blogspot.com/2012/07/essence-of-closure-conversion.html or | 70 /// http://siek.blogspot.com/2012/07/essence-of-closure-conversion.html or |
| 71 /// http://matt.might.net/articles/closure-conversion/. | 71 /// http://matt.might.net/articles/closure-conversion/. |
| 72 class KernelClosureConversionTask extends ClosureConversionTask<ir.Node> { | 72 class KernelClosureConversionTask extends ClosureConversionTask<ir.Node> { |
| 73 final KernelToElementMap _elementMap; | 73 final KernelToElementMapForBuilding _elementMap; |
| 74 final GlobalLocalsMap _globalLocalsMap; | 74 final GlobalLocalsMap _globalLocalsMap; |
| 75 Map<Entity, ClosureRepresentationInfo> _infoMap = | 75 Map<Entity, ClosureRepresentationInfo> _infoMap = |
| 76 <Entity, ClosureRepresentationInfo>{}; | 76 <Entity, ClosureRepresentationInfo>{}; |
| 77 | 77 |
| 78 KernelClosureConversionTask( | 78 KernelClosureConversionTask( |
| 79 Measurer measurer, this._elementMap, this._globalLocalsMap) | 79 Measurer measurer, this._elementMap, this._globalLocalsMap) |
| 80 : super(measurer); | 80 : super(measurer); |
| 81 | 81 |
| 82 /// The combined steps of generating our intermediate representation of | 82 /// The combined steps of generating our intermediate representation of |
| 83 /// closures that need to be rewritten and generating the element model. | 83 /// closures that need to be rewritten and generating the element model. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bool variableIsUsedInTryOrSync(Local variable) => | 146 bool variableIsUsedInTryOrSync(Local variable) => |
| 147 _localsUsedInTryOrSync.contains(variable); | 147 _localsUsedInTryOrSync.contains(variable); |
| 148 | 148 |
| 149 String toString() { | 149 String toString() { |
| 150 StringBuffer sb = new StringBuffer(); | 150 StringBuffer sb = new StringBuffer(); |
| 151 sb.write('this=$thisLocal,'); | 151 sb.write('this=$thisLocal,'); |
| 152 sb.write('localsUsedInTryOrSync={${_localsUsedInTryOrSync.join(', ')}}'); | 152 sb.write('localsUsedInTryOrSync={${_localsUsedInTryOrSync.join(', ')}}'); |
| 153 return sb.toString(); | 153 return sb.toString(); |
| 154 } | 154 } |
| 155 } | 155 } |
| OLD | NEW |