| 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 'closure.dart'; | 8 import 'closure.dart'; |
| 9 | 9 |
| 10 /// This builder walks the code to determine what variables are captured/free at | 10 /// This builder walks the code to determine what variables are captured/free at |
| 11 /// various points to build CapturedScope that can respond to queries | 11 /// various points to build CapturedScope that can respond to queries |
| 12 /// about how a particular variable is being used at any point in the code. | 12 /// about how a particular variable is being used at any point in the code. |
| 13 class CapturedScopeBuilder extends ir.Visitor { | 13 class CapturedScopeBuilder extends ir.Visitor { |
| 14 ir.TreeNode _currentLocalFunction; | 14 ir.TreeNode _currentLocalFunction; |
| 15 | 15 |
| 16 ClosureModel _model; | 16 ScopeModel _model; |
| 17 | 17 |
| 18 /// A map of each visited call node with the associated information about what | 18 /// A map of each visited call node with the associated information about what |
| 19 /// variables are captured/used. Each ir.Node key corresponds to a scope that | 19 /// variables are captured/used. Each ir.Node key corresponds to a scope that |
| 20 /// was encountered while visiting a closure (initially called through | 20 /// was encountered while visiting a closure (initially called through |
| 21 /// [translateLazyIntializer] or [translateConstructorOrProcedure]). | 21 /// [translateLazyIntializer] or [translateConstructorOrProcedure]). |
| 22 Map<ir.Node, KernelCapturedScope> get _scopesCapturedInClosureMap => | 22 Map<ir.Node, KernelCapturedScope> get _scopesCapturedInClosureMap => |
| 23 _model.capturedScopesMap; | 23 _model.capturedScopesMap; |
| 24 | 24 |
| 25 /// A map of the nodes that we have flagged as necessary to generate closure | 25 /// A map of the nodes that we have flagged as necessary to generate closure |
| 26 /// classes for in a later stage. We map that node to information ascertained | 26 /// classes for in a later stage. We map that node to information ascertained |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 void translateConstructorOrProcedure(ir.Node constructorOrProcedure) { | 280 void translateConstructorOrProcedure(ir.Node constructorOrProcedure) { |
| 281 constructorOrProcedure.accept(this); | 281 constructorOrProcedure.accept(this); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void visitFunctionNode(ir.FunctionNode functionNode) { | 284 void visitFunctionNode(ir.FunctionNode functionNode) { |
| 285 visitInvokable(functionNode); | 285 visitInvokable(functionNode); |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |