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 '../closure.dart'; | 8 import '../closure.dart'; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 /// Pop the resolved AST stack to reset it to the previous resolved AST node. | 132 /// Pop the resolved AST stack to reset it to the previous resolved AST node. |
133 void popResolvedAstStack() { | 133 void popResolvedAstStack() { |
134 assert(_resolvedAstStack.isNotEmpty); | 134 assert(_resolvedAstStack.isNotEmpty); |
135 _resolvedAst = _resolvedAstStack.removeLast(); | 135 _resolvedAst = _resolvedAstStack.removeLast(); |
136 } | 136 } |
137 | 137 |
138 Compiler get _compiler => _backend.compiler; | 138 Compiler get _compiler => _backend.compiler; |
139 TreeElements get elements => _resolvedAst.elements; | 139 TreeElements get elements => _resolvedAst.elements; |
140 DiagnosticReporter get reporter => _compiler.reporter; | 140 DiagnosticReporter get reporter => _compiler.reporter; |
141 Element get _target => _resolvedAst.element; | 141 MemberElement get _target => _resolvedAst.element; |
142 | 142 |
143 GlobalTypeInferenceResults get _globalInferenceResults => | 143 GlobalTypeInferenceResults get _globalInferenceResults => |
144 _compiler.globalInference.results; | 144 _compiler.globalInference.results; |
145 | 145 |
146 GlobalTypeInferenceElementResult _resultOf(Element e) => | 146 GlobalTypeInferenceElementResult _resultOf(MemberElement e) => |
147 _globalInferenceResults | 147 _globalInferenceResults |
148 .resultOf(e is ConstructorBodyElementX ? e.constructor : e); | 148 .resultOfMember(e is ConstructorBodyElementX ? e.constructor : e); |
149 | 149 |
150 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { | 150 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { |
151 if (kernel.syntheticNodes.contains(node)) { | 151 if (kernel.syntheticNodes.contains(node)) { |
152 return _backend.constantSystem.createSymbol( | 152 return _backend.constantSystem.createSymbol( |
153 _compiler.commonElements, _backend.backendClasses, node.value); | 153 _compiler.commonElements, _backend.backendClasses, node.value); |
154 } | 154 } |
155 ast.Node astNode = getNode(node); | 155 ast.Node astNode = getNode(node); |
156 ConstantValue constantValue = _backend.constants | 156 ConstantValue constantValue = _backend.constants |
157 .getConstantValueForNode(astNode, _resolvedAst.elements); | 157 .getConstantValueForNode(astNode, _resolvedAst.elements); |
158 assert(invariant(astNode, constantValue != null, | 158 assert(invariant(astNode, constantValue != null, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 return false; | 302 return false; |
303 } | 303 } |
304 | 304 |
305 TypeMask inferredIndexType(ir.ForInStatement forInStatement) { | 305 TypeMask inferredIndexType(ir.ForInStatement forInStatement) { |
306 return TypeMaskFactory.inferredTypeForSelector(new Selector.index(), | 306 return TypeMaskFactory.inferredTypeForSelector(new Selector.index(), |
307 typeOfIterator(forInStatement), _globalInferenceResults); | 307 typeOfIterator(forInStatement), _globalInferenceResults); |
308 } | 308 } |
309 | 309 |
310 TypeMask inferredTypeOf(ir.Member node) { | 310 TypeMask inferredTypeOf(ir.Member node) { |
311 return TypeMaskFactory.inferredTypeForElement( | 311 return TypeMaskFactory.inferredTypeForMember( |
312 getElement(node), _globalInferenceResults); | 312 getMember(node), _globalInferenceResults); |
313 } | 313 } |
314 | 314 |
315 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { | 315 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { |
316 return TypeMaskFactory.inferredTypeForSelector( | 316 return TypeMaskFactory.inferredTypeForSelector( |
317 selector, mask, _globalInferenceResults); | 317 selector, mask, _globalInferenceResults); |
318 } | 318 } |
319 | 319 |
320 TypeMask typeFromNativeBehavior( | 320 TypeMask typeFromNativeBehavior( |
321 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { | 321 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { |
322 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); | 322 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 JumpTarget continueTarget = | 824 JumpTarget continueTarget = |
825 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); | 825 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); |
826 assert(continueTarget is KernelJumpTarget); | 826 assert(continueTarget is KernelJumpTarget); |
827 targetIndexMap[continueTarget] = switchIndex; | 827 targetIndexMap[continueTarget] = switchIndex; |
828 assert(builder.jumpTargets[continueTarget] == null); | 828 assert(builder.jumpTargets[continueTarget] == null); |
829 builder.jumpTargets[continueTarget] = this; | 829 builder.jumpTargets[continueTarget] = this; |
830 switchIndex++; | 830 switchIndex++; |
831 } | 831 } |
832 } | 832 } |
833 } | 833 } |
OLD | NEW |