| 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 '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../kernel/element_map.dart'; |
| 9 import 'closure.dart'; | 10 import 'closure.dart'; |
| 10 import '../kernel/element_map.dart'; | |
| 11 | 11 |
| 12 /// This builder walks the code to determine what variables are captured/free at | 12 /// This builder walks the code to determine what variables are captured/free at |
| 13 /// various points to build ClosureScope that can respond to queries | 13 /// various points to build ClosureScope that can respond to queries |
| 14 /// about how a particular variable is being used at any point in the code. | 14 /// about how a particular variable is being used at any point in the code. |
| 15 class ClosureScopeBuilder extends ir.Visitor { | 15 class ClosureScopeBuilder extends ir.Visitor { |
| 16 /// A map of each visited call node with the associated information about what | 16 /// A map of each visited call node with the associated information about what |
| 17 /// variables are captured/used. Each ir.Node key corresponds to a scope that | 17 /// variables are captured/used. Each ir.Node key corresponds to a scope that |
| 18 /// was encountered while visiting a closure (initially called through | 18 /// was encountered while visiting a closure (initially called through |
| 19 /// [translateLazyIntializer] or [translateConstructorOrProcedure]). | 19 /// [translateLazyIntializer] or [translateConstructorOrProcedure]). |
| 20 Map<ir.Node, ClosureScope> _closureInfoMap = <ir.Node, ClosureScope>{}; | 20 Map<ir.Node, ClosureScope> _closureInfoMap = <ir.Node, ClosureScope>{}; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 nodeToConvert.isInstanceMember)) { | 285 nodeToConvert.isInstanceMember)) { |
| 286 return new ThisLocal(_kernelToElementMap.getConstructor(nodeToConvert)); | 286 return new ThisLocal(_kernelToElementMap.getConstructor(nodeToConvert)); |
| 287 } else if (nodeToConvert is ir.Procedure && | 287 } else if (nodeToConvert is ir.Procedure && |
| 288 nodeToConvert.isInstanceMember) { | 288 nodeToConvert.isInstanceMember) { |
| 289 return new ThisLocal(_kernelToElementMap.getMethod(nodeToConvert)); | 289 return new ThisLocal(_kernelToElementMap.getMethod(nodeToConvert)); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 return null; | 292 return null; |
| 293 } | 293 } |
| 294 } | 294 } |
| OLD | NEW |