| 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 '../common.dart'; | 7 import '../common.dart'; | 
| 8 import '../common/names.dart'; | 8 import '../common/names.dart'; | 
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; | 
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 46     for (LibraryElement libraryElement in kernel.libraries.keys) { | 46     for (LibraryElement libraryElement in kernel.libraries.keys) { | 
| 47       _nodeToElement[kernel.libraries[libraryElement]] = libraryElement; | 47       _nodeToElement[kernel.libraries[libraryElement]] = libraryElement; | 
| 48     } | 48     } | 
| 49     for (LocalFunctionElement localFunction in kernel.localFunctions.keys) { | 49     for (LocalFunctionElement localFunction in kernel.localFunctions.keys) { | 
| 50       _nodeToElement[kernel.localFunctions[localFunction]] = localFunction; | 50       _nodeToElement[kernel.localFunctions[localFunction]] = localFunction; | 
| 51     } | 51     } | 
| 52     _typeConverter = new DartTypeConverter(this); | 52     _typeConverter = new DartTypeConverter(this); | 
| 53   } | 53   } | 
| 54 | 54 | 
| 55   Compiler get _compiler => _backend.compiler; | 55   Compiler get _compiler => _backend.compiler; | 
| 56   TreeElements get _elements => _resolvedAst.elements; | 56   TreeElements get elements => _resolvedAst.elements; | 
| 57 | 57 | 
| 58   ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { | 58   ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { | 
| 59     ast.Node astNode = getNode(node); | 59     ast.Node astNode = getNode(node); | 
| 60     ConstantValue constantValue = _backend.constants | 60     ConstantValue constantValue = _backend.constants | 
| 61         .getConstantValueForNode(astNode, _resolvedAst.elements); | 61         .getConstantValueForNode(astNode, _resolvedAst.elements); | 
| 62     assert(invariant(astNode, constantValue != null, | 62     assert(invariant(astNode, constantValue != null, | 
| 63         message: 'No constant computed for $node')); | 63         message: 'No constant computed for $node')); | 
| 64     return constantValue; | 64     return constantValue; | 
| 65   } | 65   } | 
| 66 | 66 | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 121 | 121 | 
| 122   Selector getGetterSelector(ir.PropertyGet getter) { | 122   Selector getGetterSelector(ir.PropertyGet getter) { | 
| 123     ir.Name irName = getter.name; | 123     ir.Name irName = getter.name; | 
| 124     Name name = new Name( | 124     Name name = new Name( | 
| 125         irName.name, irName.isPrivate ? getElement(irName.library) : null); | 125         irName.name, irName.isPrivate ? getElement(irName.library) : null); | 
| 126     return new Selector.getter(name); | 126     return new Selector.getter(name); | 
| 127   } | 127   } | 
| 128 | 128 | 
| 129   TypeMask typeOfInvocation(ir.MethodInvocation invocation) { | 129   TypeMask typeOfInvocation(ir.MethodInvocation invocation) { | 
| 130     return _compiler.globalInference.results | 130     return _compiler.globalInference.results | 
| 131         .typeOfSend(getNode(invocation), _elements); | 131         .typeOfSend(getNode(invocation), elements); | 
| 132   } | 132   } | 
| 133 | 133 | 
| 134   TypeMask typeOfGet(ir.PropertyGet getter) { | 134   TypeMask typeOfGet(ir.PropertyGet getter) { | 
| 135     return _compiler.globalInference.results | 135     return _compiler.globalInference.results | 
| 136         .typeOfSend(getNode(getter), _elements); | 136         .typeOfSend(getNode(getter), elements); | 
| 137   } | 137   } | 
| 138 | 138 | 
| 139   TypeMask inferredTypeOf(ir.Member node) { | 139   TypeMask inferredTypeOf(ir.Member node) { | 
| 140     return TypeMaskFactory.inferredTypeForElement(getElement(node), _compiler); | 140     return TypeMaskFactory.inferredTypeForElement(getElement(node), _compiler); | 
| 141   } | 141   } | 
| 142 | 142 | 
| 143   TypeMask selectorTypeOf(ir.MethodInvocation invocation) { | 143   TypeMask selectorTypeOf(ir.MethodInvocation invocation) { | 
| 144     return TypeMaskFactory.inferredTypeForSelector( | 144     return TypeMaskFactory.inferredTypeForSelector( | 
| 145         getSelector(invocation), typeOfInvocation(invocation), _compiler); | 145         getSelector(invocation), typeOfInvocation(invocation), _compiler); | 
| 146   } | 146   } | 
| 147 | 147 | 
| 148   TypeMask selectorGetterTypeOf(ir.PropertyGet getter) { | 148   TypeMask selectorGetterTypeOf(ir.PropertyGet getter) { | 
| 149     return TypeMaskFactory.inferredTypeForSelector( | 149     return TypeMaskFactory.inferredTypeForSelector( | 
| 150         getGetterSelector(getter), typeOfGet(getter), _compiler); | 150         getGetterSelector(getter), typeOfGet(getter), _compiler); | 
| 151   } | 151   } | 
| 152 | 152 | 
| 153   ConstantValue getConstantFor(ir.Node node) { | 153   ConstantValue getConstantFor(ir.Node node) { | 
| 154     ConstantValue constantValue = | 154     ConstantValue constantValue = | 
| 155         _backend.constants.getConstantValueForNode(getNode(node), _elements); | 155         _backend.constants.getConstantValueForNode(getNode(node), elements); | 
| 156     assert(invariant(getNode(node), constantValue != null, | 156     assert(invariant(getNode(node), constantValue != null, | 
| 157         message: 'No constant computed for $node')); | 157         message: 'No constant computed for $node')); | 
| 158     return constantValue; | 158     return constantValue; | 
| 159   } | 159   } | 
| 160 | 160 | 
| 161   bool isIntercepted(ir.Node node) { | 161   bool isIntercepted(ir.Node node) { | 
| 162     Selector selector; | 162     Selector selector; | 
| 163     if (node is ir.PropertyGet) { | 163     if (node is ir.PropertyGet) { | 
| 164       selector = getGetterSelector(node); | 164       selector = getGetterSelector(node); | 
| 165     } else { | 165     } else { | 
| 166       selector = getSelector(node); | 166       selector = getSelector(node); | 
| 167     } | 167     } | 
| 168     return _backend.isInterceptedSelector(selector); | 168     return _backend.isInterceptedSelector(selector); | 
| 169   } | 169   } | 
| 170 | 170 | 
|  | 171   JumpTarget getTargetDefinition(ir.Node node) => | 
|  | 172       elements.getTargetDefinition(getNode(node)); | 
|  | 173 | 
| 171   ir.Procedure get mapLiteralConstructor => | 174   ir.Procedure get mapLiteralConstructor => | 
| 172       kernel.functions[_backend.helpers.mapLiteralConstructor]; | 175       kernel.functions[_backend.helpers.mapLiteralConstructor]; | 
| 173 | 176 | 
| 174   ir.Procedure get mapLiteralConstructorEmpty => | 177   ir.Procedure get mapLiteralConstructorEmpty => | 
| 175       kernel.functions[_backend.helpers.mapLiteralConstructorEmpty]; | 178       kernel.functions[_backend.helpers.mapLiteralConstructorEmpty]; | 
| 176 | 179 | 
| 177   DartType getDartType(ir.DartType type) { | 180   DartType getDartType(ir.DartType type) { | 
| 178     return type.accept(_typeConverter); | 181     return type.accept(_typeConverter); | 
| 179   } | 182   } | 
| 180 | 183 | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 217   @override | 220   @override | 
| 218   DartType visitDynamicType(ir.DynamicType node) { | 221   DartType visitDynamicType(ir.DynamicType node) { | 
| 219     return const DynamicType(); | 222     return const DynamicType(); | 
| 220   } | 223   } | 
| 221 | 224 | 
| 222   @override | 225   @override | 
| 223   DartType visitInvalidType(ir.InvalidType node) { | 226   DartType visitInvalidType(ir.InvalidType node) { | 
| 224     throw new UnimplementedError("Invalid types not currently supported"); | 227     throw new UnimplementedError("Invalid types not currently supported"); | 
| 225   } | 228   } | 
| 226 } | 229 } | 
| OLD | NEW | 
|---|