Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
| diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
| index 20768999e5c928668d8feff6b22daf113a65d026..3a268cc9fdf3692af06e54287f18ec9009d0f0ae 100644 |
| --- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
| +++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart |
| @@ -4,12 +4,15 @@ |
| import 'package:kernel/ast.dart' as ir; |
| +import '../compiler.dart'; |
| import '../constants/values.dart'; |
| import '../diagnostics/invariant.dart'; |
| import '../elements/elements.dart'; |
| import '../js_backend/js_backend.dart'; |
| +import '../resolution/tree_elements.dart'; |
| import '../tree/tree.dart' as ast; |
| import '../types/masks.dart'; |
| +import '../universe/selector.dart'; |
| import '../universe/side_effects.dart'; |
| import 'types.dart'; |
| @@ -30,8 +33,11 @@ class KernelAstAdapter { |
| } |
| } |
| + Compiler get _compiler => _backend.compiler; |
| + TreeElements get _elements => _resolvedAst.elements; |
| + |
| ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { |
| - ast.Node astNode = _nodeToAst[node]; |
| + ast.Node astNode = getNode(node); |
| ConstantValue constantValue = _backend.constants |
| .getConstantValueForNode(astNode, _resolvedAst.elements); |
| assert(invariant(astNode, constantValue != null, |
| @@ -45,17 +51,40 @@ class KernelAstAdapter { |
| return result; |
| } |
| + ast.Node getNode(ir.Node node) { |
| + ast.Node result = _nodeToAst[node]; |
| + assert(result != null); |
| + return result; |
| + } |
| + |
| bool getCanThrow(ir.Procedure procedure) { |
| FunctionElement function = getElement(procedure); |
| - return !_backend.compiler.world.getCannotThrow(function); |
| + return !_compiler.world.getCannotThrow(function); |
| } |
| TypeMask returnTypeOf(ir.Procedure node) { |
| return TypeMaskFactory.inferredReturnTypeForElement( |
| - getElement(node), _backend.compiler); |
| + getElement(node), _compiler); |
| } |
| SideEffects getSideEffects(ir.Node node) { |
| - return _backend.compiler.world.getSideEffectsOfElement(getElement(node)); |
| + return _compiler.world.getSideEffectsOfElement(getElement(node)); |
| + } |
| + |
| + Selector getSelector(ir.MethodInvocation invocation) { |
| + return _elements.getSelector(getNode(invocation)); |
|
Siggi Cherem (dart-lang)
2016/08/31 16:47:46
it's good to see all of these hooks in one place.
Harry Terkelsen
2016/08/31 16:57:14
I think we can. I added a TODO and will do it in a
|
| + } |
| + |
| + TypeMask getTypeMask(ir.MethodInvocation invocation) { |
| + return _elements.getTypeMask(getNode(invocation)); |
|
Siggi Cherem (dart-lang)
2016/08/31 16:47:46
oh my, I forgot about this one. This is likely goi
Harry Terkelsen
2016/08/31 16:57:14
I'm actually not clear on the different sources of
Siggi Cherem (dart-lang)
2016/08/31 17:03:39
I hear you. My understanding is that these are als
|
| + } |
| + |
| + TypeMask inferredTypeOf(ir.MethodInvocation invocation) { |
|
Siggi Cherem (dart-lang)
2016/08/31 16:47:46
wonder if we want to call this "selectorTypeOf" or
Harry Terkelsen
2016/08/31 16:57:14
Done.
|
| + return TypeMaskFactory.inferredTypeForSelector( |
| + getSelector(invocation), getTypeMask(invocation), _compiler); |
| + } |
| + |
| + bool isIntercepted(ir.MethodInvocation invocation) { |
| + return _backend.isInterceptedSelector(getSelector(invocation)); |
| } |
| } |