| 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'; |
| 11 import '../constants/values.dart'; | 11 import '../constants/values.dart'; |
| 12 import '../common_elements.dart'; | 12 import '../common_elements.dart'; |
| 13 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 14 import '../elements/entities.dart'; | 14 import '../elements/entities.dart'; |
| 15 import '../elements/jumps.dart'; | 15 import '../elements/jumps.dart'; |
| 16 import '../elements/modelx.dart'; | 16 import '../elements/modelx.dart'; |
| 17 import '../elements/resolution_types.dart'; | 17 import '../elements/resolution_types.dart'; |
| 18 import '../elements/types.dart'; | 18 import '../elements/types.dart'; |
| 19 import '../js_backend/js_backend.dart'; | 19 import '../js_backend/js_backend.dart'; |
| 20 import '../kernel/element_map.dart'; | 20 import '../kernel/element_map.dart'; |
| 21 import '../kernel/element_map_mixins.dart'; |
| 21 import '../kernel/kernel.dart'; | 22 import '../kernel/kernel.dart'; |
| 22 import '../native/native.dart' as native; | 23 import '../native/native.dart' as native; |
| 23 import '../resolution/tree_elements.dart'; | 24 import '../resolution/tree_elements.dart'; |
| 24 import '../tree/tree.dart' as ast; | 25 import '../tree/tree.dart' as ast; |
| 25 import '../types/masks.dart'; | 26 import '../types/masks.dart'; |
| 26 import '../types/types.dart'; | 27 import '../types/types.dart'; |
| 27 import '../universe/selector.dart'; | 28 import '../universe/selector.dart'; |
| 28 import '../world.dart'; | 29 import '../world.dart'; |
| 29 import 'graph_builder.dart'; | 30 import 'graph_builder.dart'; |
| 30 import 'jump_handler.dart' show SwitchCaseJumpHandler; | 31 import 'jump_handler.dart' show SwitchCaseJumpHandler; |
| 31 import 'locals_handler.dart'; | 32 import 'locals_handler.dart'; |
| 32 import 'types.dart'; | 33 import 'types.dart'; |
| 33 | 34 |
| 34 /// A helper class that abstracts all accesses of the AST from Kernel nodes. | 35 /// A helper class that abstracts all accesses of the AST from Kernel nodes. |
| 35 /// | 36 /// |
| 36 /// The goal is to remove all need for the AST from the Kernel SSA builder. | 37 /// The goal is to remove all need for the AST from the Kernel SSA builder. |
| 37 class KernelAstAdapter extends KernelToElementMapMixin | 38 class KernelAstAdapter extends KernelToElementMapBaseMixin |
| 38 implements KernelToLocalsMap, KernelToElementMapForImpact { | 39 with KernelToElementMapForBuildingMixin, KernelToElementMapForImpactMixin |
| 40 implements KernelToLocalsMap { |
| 39 final Kernel kernel; | 41 final Kernel kernel; |
| 40 final JavaScriptBackend _backend; | 42 final JavaScriptBackend _backend; |
| 41 final Map<ir.Node, ast.Node> _nodeToAst; | 43 final Map<ir.Node, ast.Node> _nodeToAst; |
| 42 final Map<ir.Node, Element> _nodeToElement; | 44 final Map<ir.Node, Element> _nodeToElement; |
| 43 final Map<ir.VariableDeclaration, SyntheticLocal> _syntheticLocals = | 45 final Map<ir.VariableDeclaration, SyntheticLocal> _syntheticLocals = |
| 44 <ir.VariableDeclaration, SyntheticLocal>{}; | 46 <ir.VariableDeclaration, SyntheticLocal>{}; |
| 45 // TODO(efortuna): In an ideal world the TreeNodes should be some common | 47 // TODO(efortuna): In an ideal world the TreeNodes should be some common |
| 46 // interface we create for both ir.Statements and ir.SwitchCase (the | 48 // interface we create for both ir.Statements and ir.SwitchCase (the |
| 47 // ContinueSwitchStatement's target is a SwitchCase) rather than general | 49 // ContinueSwitchStatement's target is a SwitchCase) rather than general |
| 48 // TreeNode. Talking to Asger about this. | 50 // 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) { | 672 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { |
| 671 return TypeMaskFactory.inferredTypeForSelector( | 673 return TypeMaskFactory.inferredTypeForSelector( |
| 672 selector, mask, _globalInferenceResults); | 674 selector, mask, _globalInferenceResults); |
| 673 } | 675 } |
| 674 | 676 |
| 675 TypeMask typeFromNativeBehavior( | 677 TypeMask typeFromNativeBehavior( |
| 676 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { | 678 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { |
| 677 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); | 679 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); |
| 678 } | 680 } |
| 679 } | 681 } |
| OLD | NEW |