| 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.dart'; | 8 import '../common.dart'; |
| 9 import '../common/tasks.dart'; | 9 import '../common/tasks.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 @override | 176 @override |
| 177 // TODO(efortuna): Eventually capturedScopesMap[node] should always | 177 // TODO(efortuna): Eventually capturedScopesMap[node] should always |
| 178 // be non-null, and we should just test that with an assert. | 178 // be non-null, and we should just test that with an assert. |
| 179 CapturedLoopScope getCapturedLoopScope(ir.Node loopNode) => | 179 CapturedLoopScope getCapturedLoopScope(ir.Node loopNode) => |
| 180 _capturedScopesMap[loopNode] ?? const CapturedLoopScope(); | 180 _capturedScopesMap[loopNode] ?? const CapturedLoopScope(); |
| 181 | 181 |
| 182 @override | 182 @override |
| 183 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) { | 183 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) { |
| 184 var closure = _closureRepresentationMap[entity]; | 184 var closure = _closureRepresentationMap[entity]; |
| 185 assert(closure != null, | 185 assert( |
| 186 "Corresponding closure class not found for $entity. Closures found for $
{_closureRepresentationMap.keys}"); | 186 closure != null, |
| 187 "Corresponding closure class not found for $entity. " |
| 188 "Closures found for ${_closureRepresentationMap.keys}"); |
| 187 return closure; | 189 return closure; |
| 188 } | 190 } |
| 191 |
| 192 @override |
| 193 ClosureRepresentationInfo getClosureRepresentationInfoForTesting( |
| 194 Entity member) { |
| 195 return _closureRepresentationMap[member]; |
| 196 } |
| 189 } | 197 } |
| 190 | 198 |
| 191 class KernelScopeInfo { | 199 class KernelScopeInfo { |
| 192 final Set<ir.VariableDeclaration> localsUsedInTryOrSync; | 200 final Set<ir.VariableDeclaration> localsUsedInTryOrSync; |
| 193 final bool hasThisLocal; | 201 final bool hasThisLocal; |
| 194 final Set<ir.VariableDeclaration> boxedVariables; | 202 final Set<ir.VariableDeclaration> boxedVariables; |
| 195 // If boxedVariables is empty, this will be null, because no variables will | 203 // If boxedVariables is empty, this will be null, because no variables will |
| 196 // need to be boxed. | 204 // need to be boxed. |
| 197 final NodeBox capturedVariablesAccessor; | 205 final NodeBox capturedVariablesAccessor; |
| 198 | 206 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 KernelScopeInfo scopeInfo; | 523 KernelScopeInfo scopeInfo; |
| 516 | 524 |
| 517 /// Collected [CapturedScope] data for nodes. | 525 /// Collected [CapturedScope] data for nodes. |
| 518 Map<ir.Node, KernelCapturedScope> capturedScopesMap = | 526 Map<ir.Node, KernelCapturedScope> capturedScopesMap = |
| 519 <ir.Node, KernelCapturedScope>{}; | 527 <ir.Node, KernelCapturedScope>{}; |
| 520 | 528 |
| 521 /// Collected [ScopeInfo] data for nodes. | 529 /// Collected [ScopeInfo] data for nodes. |
| 522 Map<ir.FunctionNode, KernelScopeInfo> closuresToGenerate = | 530 Map<ir.FunctionNode, KernelScopeInfo> closuresToGenerate = |
| 523 <ir.FunctionNode, KernelScopeInfo>{}; | 531 <ir.FunctionNode, KernelScopeInfo>{}; |
| 524 } | 532 } |
| OLD | NEW |