Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 '../kernel/element_map.dart'; | 10 import '../kernel/element_map.dart'; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 138 |
| 139 @override | 139 @override |
| 140 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, | 140 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, |
| 141 // and we should just test that with an assert. | 141 // and we should just test that with an assert. |
| 142 LoopClosureScope getLoopClosureScope(ir.Node loopNode) => | 142 LoopClosureScope getLoopClosureScope(ir.Node loopNode) => |
| 143 _closureScopeMap[loopNode] ?? const LoopClosureScope(); | 143 _closureScopeMap[loopNode] ?? const LoopClosureScope(); |
| 144 | 144 |
| 145 @override | 145 @override |
| 146 // TODO(efortuna): Eventually closureRepresentationMap[node] should always be | 146 // TODO(efortuna): Eventually closureRepresentationMap[node] should always be |
| 147 // non-null, and we should just test that with an assert. | 147 // non-null, and we should just test that with an assert. |
| 148 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) => | 148 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) { |
| 149 _closureRepresentationMap[entity] ?? const ClosureRepresentationInfo(); | 149 if (entity is ConstructorBodyEntity) { |
| 150 ConstructorBodyEntity constructorBody = entity; | |
| 151 entity = constructorBody.constructor; | |
|
Siggi Cherem (dart-lang)
2017/07/07 20:00:25
it might be nice to do this at the call site thoug
Johnni Winther
2017/07/10 14:11:33
Long-term constructor body should have there own a
| |
| 152 } | |
| 153 return _closureRepresentationMap[entity] ?? | |
| 154 const ClosureRepresentationInfo(); | |
| 155 } | |
| 150 } | 156 } |
| 151 | 157 |
| 152 class KernelScopeInfo extends ScopeInfo { | 158 class KernelScopeInfo extends ScopeInfo { |
| 153 final Set<Local> localsUsedInTryOrSync; | 159 final Set<Local> localsUsedInTryOrSync; |
| 154 final Local thisLocal; | 160 final Local thisLocal; |
| 155 final Set<Local> boxedVariables; | 161 final Set<Local> boxedVariables; |
| 156 | 162 |
| 157 /// The set of variables that were defined in another scope, but are used in | 163 /// The set of variables that were defined in another scope, but are used in |
| 158 /// this scope. | 164 /// this scope. |
| 159 Set<ir.VariableDeclaration> freeVariables = new Set<ir.VariableDeclaration>(); | 165 Set<ir.VariableDeclaration> freeVariables = new Set<ir.VariableDeclaration>(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 // TODO(efortuna): Implement. | 249 // TODO(efortuna): Implement. |
| 244 bool isVariableBoxed(Local variable) => false; | 250 bool isVariableBoxed(Local variable) => false; |
| 245 | 251 |
| 246 // TODO(efortuna): Implement. | 252 // TODO(efortuna): Implement. |
| 247 // Why is this closure not actually a closure? Well, to properly call | 253 // Why is this closure not actually a closure? Well, to properly call |
| 248 // ourselves a closure, we need to register the new closure class with the | 254 // ourselves a closure, we need to register the new closure class with the |
| 249 // ClosedWorldRefiner, which currently only takes elements. The change to | 255 // ClosedWorldRefiner, which currently only takes elements. The change to |
| 250 // that (and the subsequent adjustment here) will follow soon. | 256 // that (and the subsequent adjustment here) will follow soon. |
| 251 bool get isClosure => false; | 257 bool get isClosure => false; |
| 252 } | 258 } |
| OLD | NEW |