OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../compiler.dart'; | 9 import '../compiler.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 import '../world.dart'; | 28 import '../world.dart'; |
29 import 'graph_builder.dart'; | 29 import 'graph_builder.dart'; |
30 import 'jump_handler.dart' show SwitchCaseJumpHandler; | 30 import 'jump_handler.dart' show SwitchCaseJumpHandler; |
31 import 'locals_handler.dart'; | 31 import 'locals_handler.dart'; |
32 import 'types.dart'; | 32 import 'types.dart'; |
33 | 33 |
34 /// A helper class that abstracts all accesses of the AST from Kernel nodes. | 34 /// A helper class that abstracts all accesses of the AST from Kernel nodes. |
35 /// | 35 /// |
36 /// The goal is to remove all need for the AST from the Kernel SSA builder. | 36 /// The goal is to remove all need for the AST from the Kernel SSA builder. |
37 class KernelAstAdapter extends KernelToElementMapMixin | 37 class KernelAstAdapter extends KernelToElementMapMixin |
38 implements KernelToLocalsMap { | 38 implements KernelToLocalsMap, KernelToElementMapForImpact { |
39 final Kernel kernel; | 39 final Kernel kernel; |
40 final JavaScriptBackend _backend; | 40 final JavaScriptBackend _backend; |
41 final Map<ir.Node, ast.Node> _nodeToAst; | 41 final Map<ir.Node, ast.Node> _nodeToAst; |
42 final Map<ir.Node, Element> _nodeToElement; | 42 final Map<ir.Node, Element> _nodeToElement; |
43 final Map<ir.VariableDeclaration, SyntheticLocal> _syntheticLocals = | 43 final Map<ir.VariableDeclaration, SyntheticLocal> _syntheticLocals = |
44 <ir.VariableDeclaration, SyntheticLocal>{}; | 44 <ir.VariableDeclaration, SyntheticLocal>{}; |
45 // TODO(efortuna): In an ideal world the TreeNodes should be some common | 45 // TODO(efortuna): In an ideal world the TreeNodes should be some common |
46 // interface we create for both ir.Statements and ir.SwitchCase (the | 46 // interface we create for both ir.Statements and ir.SwitchCase (the |
47 // ContinueSwitchStatement's target is a SwitchCase) rather than general | 47 // ContinueSwitchStatement's target is a SwitchCase) rather than general |
48 // TreeNode. Talking to Asger about this. | 48 // TreeNode. Talking to Asger about this. |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { | 670 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { |
671 return TypeMaskFactory.inferredTypeForSelector( | 671 return TypeMaskFactory.inferredTypeForSelector( |
672 selector, mask, _globalInferenceResults); | 672 selector, mask, _globalInferenceResults); |
673 } | 673 } |
674 | 674 |
675 TypeMask typeFromNativeBehavior( | 675 TypeMask typeFromNativeBehavior( |
676 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { | 676 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { |
677 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); | 677 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); |
678 } | 678 } |
679 } | 679 } |
OLD | NEW |