Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2964683003: Split implementation of KernelToElementMapImpl (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 for (LocalFunctionElement localFunction in kernel.localFunctions.keys) { 81 for (LocalFunctionElement localFunction in kernel.localFunctions.keys) {
82 _nodeToElement[kernel.localFunctions[localFunction]] = localFunction; 82 _nodeToElement[kernel.localFunctions[localFunction]] = localFunction;
83 } 83 }
84 for (TypeVariableElement typeVariable in kernel.typeParameters.keys) { 84 for (TypeVariableElement typeVariable in kernel.typeParameters.keys) {
85 _nodeToElement[kernel.typeParameters[typeVariable]] = typeVariable; 85 _nodeToElement[kernel.typeParameters[typeVariable]] = typeVariable;
86 } 86 }
87 _typeConverter = new DartTypeConverter(this); 87 _typeConverter = new DartTypeConverter(this);
88 } 88 }
89 89
90 void addProgram(ir.Program node) {
91 throw new UnsupportedError('KernelAstAdapter.addProgram');
92 }
93
90 @override 94 @override
91 ConstantValue computeConstantValue(ConstantExpression constant, 95 ConstantValue computeConstantValue(ConstantExpression constant,
92 {bool requireConstant: true}) { 96 {bool requireConstant: true}) {
93 _compiler.backend.constants.evaluate(constant); 97 _compiler.backend.constants.evaluate(constant);
94 ConstantValue value = 98 ConstantValue value =
95 _compiler.backend.constants.getConstantValue(constant); 99 _compiler.backend.constants.getConstantValue(constant);
96 if (value == null && requireConstant) { 100 if (value == null && requireConstant) {
97 throw new UnsupportedError( 101 throw new UnsupportedError(
98 'No constant value for ${constant.toStructuredText()}'); 102 'No constant value for ${constant.toStructuredText()}');
99 } 103 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 target = kernel.localFunctions[classMap.closureEntity]; 136 target = kernel.localFunctions[classMap.closureEntity];
133 } 137 }
134 } 138 }
135 } else if (originTarget is FieldElement) { 139 } else if (originTarget is FieldElement) {
136 target = kernel.fields[originTarget]; 140 target = kernel.fields[originTarget];
137 } 141 }
138 assert(target != null); 142 assert(target != null);
139 return target; 143 return target;
140 } 144 }
141 145
146 ir.Node getClassNode(ClassElement cls) {
147 throw new UnsupportedError('KernelAstAdapter.getClassNode');
148 }
149
142 @override 150 @override
143 CommonElements get commonElements => _compiler.resolution.commonElements; 151 CommonElements get commonElements => _compiler.resolution.commonElements;
144 152
145 @override 153 @override
146 ElementEnvironment get elementEnvironment => 154 ElementEnvironment get elementEnvironment =>
147 _compiler.resolution.elementEnvironment; 155 _compiler.resolution.elementEnvironment;
148 156
149 MemberElement get currentMember => _resolvedAst.element; 157 MemberElement get currentMember => _resolvedAst.element;
150 158
151 /// Push the existing resolved AST on the stack and shift the current resolved 159 /// Push the existing resolved AST on the stack and shift the current resolved
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { 680 TypeMask selectorTypeOf(Selector selector, TypeMask mask) {
673 return TypeMaskFactory.inferredTypeForSelector( 681 return TypeMaskFactory.inferredTypeForSelector(
674 selector, mask, _globalInferenceResults); 682 selector, mask, _globalInferenceResults);
675 } 683 }
676 684
677 TypeMask typeFromNativeBehavior( 685 TypeMask typeFromNativeBehavior(
678 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { 686 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
679 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); 687 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
680 } 688 }
681 } 689 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698