| 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:js_runtime/shared/embedded_names.dart'; | 5 import 'package:js_runtime/shared/embedded_names.dart'; |
| 6 import 'package:kernel/ast.dart' as ir; | 6 import 'package:kernel/ast.dart' as ir; |
| 7 | 7 |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
| 10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
| 11 import '../constants/expressions.dart'; | 11 import '../constants/expressions.dart'; |
| 12 import '../constants/values.dart'; | 12 import '../constants/values.dart'; |
| 13 import '../elements/resolution_types.dart'; | 13 import '../elements/resolution_types.dart'; |
| 14 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
| 15 import '../elements/entities.dart' show MemberEntity; |
| 15 import '../elements/modelx.dart'; | 16 import '../elements/modelx.dart'; |
| 16 import '../js/js.dart' as js; | 17 import '../js/js.dart' as js; |
| 17 import '../js_backend/backend_helpers.dart'; | 18 import '../js_backend/backend_helpers.dart'; |
| 18 import '../js_backend/js_backend.dart'; | 19 import '../js_backend/js_backend.dart'; |
| 19 import '../kernel/kernel.dart'; | 20 import '../kernel/kernel.dart'; |
| 20 import '../kernel/kernel_debug.dart'; | 21 import '../kernel/kernel_debug.dart'; |
| 21 import '../native/native.dart' as native; | 22 import '../native/native.dart' as native; |
| 22 import '../resolution/tree_elements.dart'; | 23 import '../resolution/tree_elements.dart'; |
| 23 import '../tree/tree.dart' as ast; | 24 import '../tree/tree.dart' as ast; |
| 24 import '../types/masks.dart'; | 25 import '../types/masks.dart'; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 97 |
| 97 Compiler get _compiler => _backend.compiler; | 98 Compiler get _compiler => _backend.compiler; |
| 98 TreeElements get elements => _resolvedAst.elements; | 99 TreeElements get elements => _resolvedAst.elements; |
| 99 DiagnosticReporter get reporter => _compiler.reporter; | 100 DiagnosticReporter get reporter => _compiler.reporter; |
| 100 Element get _target => _resolvedAst.element; | 101 Element get _target => _resolvedAst.element; |
| 101 | 102 |
| 102 GlobalTypeInferenceResults get _globalInferenceResults => | 103 GlobalTypeInferenceResults get _globalInferenceResults => |
| 103 _compiler.globalInference.results; | 104 _compiler.globalInference.results; |
| 104 | 105 |
| 105 GlobalTypeInferenceElementResult _resultOf(Element e) => | 106 GlobalTypeInferenceElementResult _resultOf(Element e) => |
| 106 _globalInferenceResults.resultOf(e); | 107 _globalInferenceResults |
| 108 .resultOf(e is ConstructorBodyElementX ? e.constructor : e); |
| 107 | 109 |
| 108 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { | 110 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { |
| 109 if (kernel.syntheticNodes.contains(node)) { | 111 if (kernel.syntheticNodes.contains(node)) { |
| 110 return _backend.constantSystem.createSymbol(_compiler, node.value); | 112 return _backend.constantSystem.createSymbol(_compiler, node.value); |
| 111 } | 113 } |
| 112 ast.Node astNode = getNode(node); | 114 ast.Node astNode = getNode(node); |
| 113 ConstantValue constantValue = _backend.constants | 115 ConstantValue constantValue = _backend.constants |
| 114 .getConstantValueForNode(astNode, _resolvedAst.elements); | 116 .getConstantValueForNode(astNode, _resolvedAst.elements); |
| 115 assert(invariant(astNode, constantValue != null, | 117 assert(invariant(astNode, constantValue != null, |
| 116 message: 'No constant computed for $node')); | 118 message: 'No constant computed for $node')); |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 808 |
| 807 /// Computes the native behavior for calling [procedure]. | 809 /// Computes the native behavior for calling [procedure]. |
| 808 // TODO(johnniwinther): Cache this for later use. | 810 // TODO(johnniwinther): Cache this for later use. |
| 809 native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure) { | 811 native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure) { |
| 810 ResolutionDartType type = getFunctionType(procedure.function); | 812 ResolutionDartType type = getFunctionType(procedure.function); |
| 811 List<ConstantExpression> metadata = getMetadata(procedure.annotations); | 813 List<ConstantExpression> metadata = getMetadata(procedure.annotations); |
| 812 return native.NativeBehavior.ofMethod(CURRENT_ELEMENT_SPANNABLE, type, | 814 return native.NativeBehavior.ofMethod(CURRENT_ELEMENT_SPANNABLE, type, |
| 813 metadata, _typeLookup(resolveAsRaw: false), _compiler, | 815 metadata, _typeLookup(resolveAsRaw: false), _compiler, |
| 814 isJsInterop: false); | 816 isJsInterop: false); |
| 815 } | 817 } |
| 818 |
| 819 MemberEntity getConstructorBodyEntity(ir.Constructor constructor) { |
| 820 AstElement element = getElement(constructor); |
| 821 MemberEntity constructorBody = |
| 822 ConstructorBodyElementX.createFromResolvedAst(element.resolvedAst); |
| 823 assert(constructorBody != null); |
| 824 return constructorBody; |
| 825 } |
| 816 } | 826 } |
| 817 | 827 |
| 818 /// Kinds of foreign functions. | 828 /// Kinds of foreign functions. |
| 819 enum ForeignKind { | 829 enum ForeignKind { |
| 820 JS, | 830 JS, |
| 821 JS_BUILTIN, | 831 JS_BUILTIN, |
| 822 JS_EMBEDDED_GLOBAL, | 832 JS_EMBEDDED_GLOBAL, |
| 823 JS_INTERCEPTOR_CONSTANT, | 833 JS_INTERCEPTOR_CONSTANT, |
| 824 NONE, | 834 NONE, |
| 825 } | 835 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 JumpTarget continueTarget = | 1083 JumpTarget continueTarget = |
| 1074 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); | 1084 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); |
| 1075 assert(continueTarget is KernelJumpTarget); | 1085 assert(continueTarget is KernelJumpTarget); |
| 1076 targetIndexMap[continueTarget] = switchIndex; | 1086 targetIndexMap[continueTarget] = switchIndex; |
| 1077 assert(builder.jumpTargets[continueTarget] == null); | 1087 assert(builder.jumpTargets[continueTarget] == null); |
| 1078 builder.jumpTargets[continueTarget] = this; | 1088 builder.jumpTargets[continueTarget] = this; |
| 1079 switchIndex++; | 1089 switchIndex++; |
| 1080 } | 1090 } |
| 1081 } | 1091 } |
| 1082 } | 1092 } |
| OLD | NEW |