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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../common_elements.dart'; 10 import '../common_elements.dart';
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 /// Computes the [ConstantValue] for the constant [expression]. 101 /// Computes the [ConstantValue] for the constant [expression].
102 // TODO(johnniwinther): Move to [KernelToElementMapForBuilding]. This is only 102 // TODO(johnniwinther): Move to [KernelToElementMapForBuilding]. This is only
103 // used in impact builder for symbol constants. 103 // used in impact builder for symbol constants.
104 ConstantValue getConstantValue(ir.Expression expression, 104 ConstantValue getConstantValue(ir.Expression expression,
105 {bool requireConstant: true, bool implicitNull: false}); 105 {bool requireConstant: true, bool implicitNull: false});
106 } 106 }
107 107
108 /// Interface that translates between Kernel IR nodes and entities used for 108 /// Interface that translates between Kernel IR nodes and entities used for
109 /// computing the [WorldImpact] for members. 109 /// computing the [WorldImpact] for members.
110 abstract class KernelToElementMapForImpact extends KernelToElementMap { 110 abstract class KernelToElementMapForImpact extends KernelToElementMap {
111 /// Adds libraries in [program] to the set of libraries.
112 ///
113 /// The main method of the first program is used as the main method for the
114 /// compilation.
115 void addProgram(ir.Program program);
116
111 /// Returns the [ConstructorEntity] corresponding to a super initializer in 117 /// Returns the [ConstructorEntity] corresponding to a super initializer in
112 /// [constructor]. 118 /// [constructor].
113 /// 119 ///
114 /// The IR resolves super initializers to a [target] up in the type hierarchy. 120 /// The IR resolves super initializers to a [target] up in the type hierarchy.
115 /// Most of the time, the result of this function will be the entity 121 /// Most of the time, the result of this function will be the entity
116 /// corresponding to that target. In the presence of unnamed mixins, this 122 /// corresponding to that target. In the presence of unnamed mixins, this
117 /// function returns an entity for an intermediate synthetic constructor that 123 /// function returns an entity for an intermediate synthetic constructor that
118 /// kernel doesn't explicitly represent. 124 /// kernel doesn't explicitly represent.
119 /// 125 ///
120 /// For example: 126 /// For example:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 abstract class KernelToElementMapForBuilding implements KernelToElementMap { 160 abstract class KernelToElementMapForBuilding implements KernelToElementMap {
155 /// [ElementEnvironment] for library, class and member lookup. 161 /// [ElementEnvironment] for library, class and member lookup.
156 ElementEnvironment get elementEnvironment; 162 ElementEnvironment get elementEnvironment;
157 163
158 /// Returns the list of [DartType]s corresponding to [types]. 164 /// Returns the list of [DartType]s corresponding to [types].
159 List<DartType> getDartTypes(List<ir.DartType> types); 165 List<DartType> getDartTypes(List<ir.DartType> types);
160 166
161 /// Returns the kernel IR node that defines the [member]. 167 /// Returns the kernel IR node that defines the [member].
162 ir.Node getMemberNode(covariant MemberEntity member); 168 ir.Node getMemberNode(covariant MemberEntity member);
163 169
170 /// Returns the kernel IR node that defines the [cls].
171 ir.Class getClassNode(covariant ClassEntity cls);
172
164 /// Returns the [LibraryEntity] corresponding to the library [node]. 173 /// Returns the [LibraryEntity] corresponding to the library [node].
165 LibraryEntity getLibrary(ir.Library node); 174 LibraryEntity getLibrary(ir.Library node);
166 175
167 /// Returns the [js.Template] for the `JsBuiltin` [constant] value. 176 /// Returns the [js.Template] for the `JsBuiltin` [constant] value.
168 js.Template getJsBuiltinTemplate( 177 js.Template getJsBuiltinTemplate(
169 ConstantValue constant, CodeEmitterTask emitter); 178 ConstantValue constant, CodeEmitterTask emitter);
170 179
171 /// Return the [ConstantValue] the initial value of [field] or `null` if 180 /// Return the [ConstantValue] the initial value of [field] or `null` if
172 /// the initializer is not a constant expression. 181 /// the initializer is not a constant expression.
173 ConstantValue getFieldConstantValue(ir.Field field); 182 ConstantValue getFieldConstantValue(ir.Field field);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 /// Returns the [LoopClosureScope] for the loop [node] in [closureClassMaps]. 310 /// Returns the [LoopClosureScope] for the loop [node] in [closureClassMaps].
302 LoopClosureScope getLoopClosureScope( 311 LoopClosureScope getLoopClosureScope(
303 ClosureDataLookup closureLookup, ir.TreeNode node); 312 ClosureDataLookup closureLookup, ir.TreeNode node);
304 } 313 }
305 314
306 /// Comparator for the canonical order or named arguments. 315 /// Comparator for the canonical order or named arguments.
307 // TODO(johnniwinther): Remove this when named parameters are sorted in dill. 316 // TODO(johnniwinther): Remove this when named parameters are sorted in dill.
308 int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) { 317 int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) {
309 return a.name.compareTo(b.name); 318 return a.name.compareTo(b.name);
310 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698