| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 assert(entity != null); | 119 assert(entity != null); |
| 120 | 120 |
| 121 _closureRepresentationMap[entity] = closureClass; | 121 _closureRepresentationMap[entity] = closureClass; |
| 122 } | 122 } |
| 123 | 123 |
| 124 @override | 124 @override |
| 125 ScopeInfo getScopeInfo(Entity entity) { | 125 ScopeInfo getScopeInfo(Entity entity) { |
| 126 return getClosureRepresentationInfo(entity); | 126 return getClosureRepresentationInfo(entity); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, |
| 130 // and we should just test that with an assert. |
| 131 ClosureScope _getClosureScope(ir.Node node) => |
| 132 _closureScopeMap[node] ?? const ClosureScope(); |
| 133 |
| 134 @override |
| 135 ClosureScope getClosureScope(MemberEntity entity) { |
| 136 return _getClosureScope(_elementMap.getMemberNode(entity)); |
| 137 } |
| 138 |
| 129 @override | 139 @override |
| 130 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, | 140 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, |
| 131 // and we should just test that with an assert. | 141 // and we should just test that with an assert. |
| 132 ClosureScope getClosureScope(ir.Node node) => | |
| 133 _closureScopeMap[node] ?? const ClosureScope(); | |
| 134 | |
| 135 @override | |
| 136 // TODO(efortuna): Eventually closureScopeMap[node] should always be non-null, | |
| 137 // and we should just test that with an assert. | |
| 138 LoopClosureScope getLoopClosureScope(ir.Node loopNode) => | 142 LoopClosureScope getLoopClosureScope(ir.Node loopNode) => |
| 139 _closureScopeMap[loopNode] ?? const LoopClosureScope(); | 143 _closureScopeMap[loopNode] ?? const LoopClosureScope(); |
| 140 | 144 |
| 141 @override | 145 @override |
| 142 // TODO(efortuna): Eventually closureRepresentationMap[node] should always be | 146 // TODO(efortuna): Eventually closureRepresentationMap[node] should always be |
| 143 // non-null, and we should just test that with an assert. | 147 // non-null, and we should just test that with an assert. |
| 144 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) => | 148 ClosureRepresentationInfo getClosureRepresentationInfo(Entity entity) => |
| 145 _closureRepresentationMap[entity] ?? const ClosureRepresentationInfo(); | 149 _closureRepresentationMap[entity] ?? const ClosureRepresentationInfo(); |
| 146 } | 150 } |
| 147 | 151 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // TODO(efortuna): Implement. | 243 // TODO(efortuna): Implement. |
| 240 bool isVariableBoxed(Local variable) => false; | 244 bool isVariableBoxed(Local variable) => false; |
| 241 | 245 |
| 242 // TODO(efortuna): Implement. | 246 // TODO(efortuna): Implement. |
| 243 // Why is this closure not actually a closure? Well, to properly call | 247 // Why is this closure not actually a closure? Well, to properly call |
| 244 // ourselves a closure, we need to register the new closure class with the | 248 // ourselves a closure, we need to register the new closure class with the |
| 245 // ClosedWorldRefiner, which currently only takes elements. The change to | 249 // ClosedWorldRefiner, which currently only takes elements. The change to |
| 246 // that (and the subsequent adjustment here) will follow soon. | 250 // that (and the subsequent adjustment here) will follow soon. |
| 247 bool get isClosure => false; | 251 bool get isClosure => false; |
| 248 } | 252 } |
| OLD | NEW |