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

Unified Diff: pkg/compiler/lib/src/kernel/element_map_mixins.dart

Issue 2955093002: Split KernelToElementMap mixins to match interfaces (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/element_map_mixins.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
similarity index 70%
copy from pkg/compiler/lib/src/kernel/element_map.dart
copy to pkg/compiler/lib/src/kernel/element_map_mixins.dart
index 6dcff310c781af918b18ba09432f2e945b255aaf..19f776edcc2ca7f2ee00c80f48182807a71ba52f 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
@@ -5,7 +5,6 @@
import 'package:js_runtime/shared/embedded_names.dart';
import 'package:kernel/ast.dart' as ir;
-import '../closure.dart';
import '../common.dart';
import '../common/names.dart';
import '../constants/constructors.dart';
@@ -13,7 +12,6 @@ import '../constants/expressions.dart';
import '../constants/values.dart';
import '../common_elements.dart';
import '../elements/entities.dart';
-import '../elements/jumps.dart';
import '../elements/names.dart';
import '../elements/operators.dart';
import '../elements/types.dart';
@@ -22,185 +20,16 @@ import '../js_backend/backend.dart' show JavaScriptBackend;
import '../js_backend/namer.dart';
import '../js_emitter/code_emitter_task.dart';
import '../native/native.dart' as native;
-import '../types/types.dart';
import '../universe/call_structure.dart';
import '../universe/selector.dart';
-import '../world.dart';
+import 'element_map.dart';
import 'kernel_debug.dart';
-/// Interface that translates between Kernel IR nodes and entities.
-abstract class KernelToElementMap {
- /// Access to the commonly used elements and types.
- CommonElements get commonElements;
-
- /// Returns the [DartType] corresponding to [type].
- DartType getDartType(ir.DartType type);
-
- /// Return the [InterfaceType] corresponding to the [cls] with the given
- /// [typeArguments].
- InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments);
-
- /// Returns the [Selector] corresponding to the invocation or getter/setter
- /// access of [node].
- Selector getSelector(ir.Expression node);
-
- /// Returns the [MemberEntity] corresponding to the member [node].
- MemberEntity getMember(ir.Member node);
-
- /// Returns the [FunctionEntity] corresponding to the procedure [node].
- FunctionEntity getMethod(ir.Procedure node);
-
- /// Returns the [ConstructorEntity] corresponding to the generative or factory
- /// constructor [node].
- ConstructorEntity getConstructor(ir.Member node);
-
- /// Returns the [FieldEntity] corresponding to the field [node].
- FieldEntity getField(ir.Field node);
-
- /// Returns the [Local] corresponding to the [node]. The node must be either
- /// a [ir.FunctionDeclaration] or [ir.FunctionExpression].
- Local getLocalFunction(ir.TreeNode node);
-
- /// Returns the super [MemberEntity] for a super invocation, get or set of
- /// [name] from the member [context].
- ///
- /// The IR doesn't always resolve super accesses to the corresponding
- /// [target]. If not, the target is computed using [name] and [setter] from
- /// the enclosing class of [context].
- MemberEntity getSuperMember(ir.Member context, ir.Name name, ir.Member target,
- {bool setter: false});
-
- /// Returns the [Name] corresponding to [name].
- Name getName(ir.Name name);
-
- /// Return `true` if [node] is the `dart:_foreign_helper` library.
- bool isForeignLibrary(ir.Library node);
-
- /// Computes the [native.NativeBehavior] for a call to the [JS] function.
- native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
-
- /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
- /// function.
- native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
- ir.StaticInvocation node);
-
- /// Computes the [native.NativeBehavior] for a call to the
- /// [JS_EMBEDDED_GLOBAL] function.
- native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
- ir.StaticInvocation node);
-
- /// Returns the [js.Name] for the `JsGetName` [constant] value.
- js.Name getNameForJsGetName(ConstantValue constant, Namer namer);
-
- /// Computes the [ConstantValue] for the constant [expression].
- // TODO(johnniwinther): Move to [KernelToElementMapForBuilding]. This is only
- // used in impact builder for symbol constants.
- ConstantValue getConstantValue(ir.Expression expression,
- {bool requireConstant: true, bool implicitNull: false});
-}
-
-/// Interface that translates between Kernel IR nodes and entities used for
-/// computing the [WorldImpact] for members.
-abstract class KernelToElementMapForImpact extends KernelToElementMap {
- /// Returns the [CallStructure] corresponding to the [arguments].
- CallStructure getCallStructure(ir.Arguments arguments);
-
- /// Returns the [ConstructorEntity] corresponding to a super initializer in
- /// [constructor].
- ///
- /// The IR resolves super initializers to a [target] up in the type hierarchy.
- /// Most of the time, the result of this function will be the entity
- /// corresponding to that target. In the presence of unnamed mixins, this
- /// function returns an entity for an intermediate synthetic constructor that
- /// kernel doesn't explicitly represent.
- ///
- /// For example:
- /// class M {}
- /// class C extends Object with M {}
- ///
- /// Kernel will say that C()'s super initializer resolves to Object(), but
- /// this function will return an entity representing the unnamed mixin
- /// application "Object+M"'s constructor.
- ConstructorEntity getSuperConstructor(
- ir.Constructor constructor, ir.Member target);
-
- /// Returns `true` is [node] has a `@Native(...)` annotation.
- bool isNativeClass(ir.Class node);
-
- /// Computes the native behavior for reading the native [field].
- native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
- {bool isJsInterop});
-
- /// Computes the native behavior for writing to the native [field].
- native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field);
-
- /// Computes the native behavior for calling [procedure].
- native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure,
- {bool isJsInterop});
-
- /// Compute the kind of foreign helper function called by [node], if any.
- ForeignKind getForeignKind(ir.StaticInvocation node);
-
- /// Computes the [InterfaceType] referenced by a call to the
- /// [JS_INTERCEPTOR_CONSTANT] function, if any.
- InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node);
-}
-
-/// Interface that translates between Kernel IR nodes and entities used for
-/// global type inference and building the SSA graph for members.
-abstract class KernelToElementMapForBuilding implements KernelToElementMap {
- /// [ElementEnvironment] for library, class and member lookup.
+abstract class KernelToElementMapBaseMixin implements KernelToElementMap {
+ DiagnosticReporter get reporter;
ElementEnvironment get elementEnvironment;
-
- /// Returns the [FunctionType] of the [node].
- FunctionType getFunctionType(ir.FunctionNode node);
-
- /// Returns the list of [DartType]s corresponding to [types].
- List<DartType> getDartTypes(List<ir.DartType> types);
-
- /// Returns the [InterfaceType] corresponding to [type].
- InterfaceType getInterfaceType(ir.InterfaceType type);
-
- /// Returns the kernel IR node that defines the [member].
- ir.Node getMemberNode(covariant MemberEntity member);
-
- /// Returns the [ClassEntity] corresponding to the class [node].
- ClassEntity getClass(ir.Class node);
-
- /// Returns the [LibraryEntity] corresponding to the library [node].
LibraryEntity getLibrary(ir.Library node);
- /// Returns the [js.Template] for the `JsBuiltin` [constant] value.
- js.Template getJsBuiltinTemplate(
- ConstantValue constant, CodeEmitterTask emitter);
-
- /// Return the [ConstantValue] the initial value of [field] or `null` if
- /// the initializer is not a constant expression.
- ConstantValue getFieldConstantValue(ir.Field field);
-
- /// Returns the `noSuchMethod` [FunctionEntity] call from a
- /// `super.noSuchMethod` invocation within [cls].
- FunctionEntity getSuperNoSuchMethod(ClassEntity cls);
-
- /// Returns a [Spannable] for a message pointing to the IR [node] in the
- /// context of [member].
- Spannable getSpannable(MemberEntity member, ir.Node node);
-}
-
-/// Kinds of foreign functions.
-enum ForeignKind {
- JS,
- JS_BUILTIN,
- JS_EMBEDDED_GLOBAL,
- JS_INTERCEPTOR_CONSTANT,
- NONE,
-}
-
-abstract class KernelToElementMapMixin
- implements KernelToElementMapForBuilding {
- DiagnosticReporter get reporter;
- native.BehaviorBuilder get nativeBehaviorBuilder;
ConstantValue computeConstantValue(ConstantExpression constant,
{bool requireConstant: true});
@@ -271,70 +100,6 @@ abstract class KernelToElementMapMixin
return new Selector.setter(name);
}
- ConstantValue getConstantValue(ir.Expression node,
- {bool requireConstant: true, bool implicitNull: false}) {
- ConstantExpression constant;
- if (node == null) {
- if (!implicitNull) {
- throw new SpannableAssertionFailure(
- CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
- }
- constant = new NullConstantExpression();
- } else {
- constant =
- new Constantifier(this, requireConstant: requireConstant).visit(node);
- }
- if (constant == null) {
- if (requireConstant) {
- throw new UnsupportedError(
- 'No constant for ${DebugPrinter.prettyPrint(node)}');
- }
- return null;
- }
- return computeConstantValue(constant, requireConstant: requireConstant);
- }
-
- /// Converts [annotations] into a list of [ConstantValue]s.
- List<ConstantValue> getMetadata(List<ir.Expression> annotations) {
- if (annotations.isEmpty) return const <ConstantValue>[];
- List<ConstantValue> metadata = <ConstantValue>[];
- annotations.forEach((ir.Expression node) {
- metadata.add(getConstantValue(node));
- });
- return metadata;
- }
-
- /// Returns `true` is [node] has a `@Native(...)` annotation.
- // TODO(johnniwinther): Cache this for later use.
- bool isNativeClass(ir.Class node) {
- for (ir.Expression annotation in node.annotations) {
- if (annotation is ir.ConstructorInvocation) {
- FunctionEntity target = getConstructor(annotation.target);
- if (target.enclosingClass == commonElements.nativeAnnotationClass) {
- return true;
- }
- }
- }
- return false;
- }
-
- /// Compute the kind of foreign helper function called by [node], if any.
- ForeignKind getForeignKind(ir.StaticInvocation node) {
- if (isForeignLibrary(node.target.enclosingLibrary)) {
- switch (node.target.name.name) {
- case JavaScriptBackend.JS:
- return ForeignKind.JS;
- case JavaScriptBackend.JS_BUILTIN:
- return ForeignKind.JS_BUILTIN;
- case JavaScriptBackend.JS_EMBEDDED_GLOBAL:
- return ForeignKind.JS_EMBEDDED_GLOBAL;
- case JavaScriptBackend.JS_INTERCEPTOR_CONSTANT:
- return ForeignKind.JS_INTERCEPTOR_CONSTANT;
- }
- }
- return ForeignKind.NONE;
- }
-
/// Return `true` if [node] is the `dart:_foreign_helper` library.
bool isForeignLibrary(ir.Library node) {
return node.importUri == Uris.dart__foreign_helper;
@@ -487,6 +252,98 @@ abstract class KernelToElementMapMixin
commonElements);
}
+ js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
+ int index = _extractEnumIndexFromConstantValue(
+ constant, commonElements.jsGetNameEnum);
+ if (index == null) return null;
+ return namer.getNameForJsGetName(
+ CURRENT_ELEMENT_SPANNABLE, JsGetName.values[index]);
+ }
+
+ int _extractEnumIndexFromConstantValue(
+ ConstantValue constant, ClassEntity classElement) {
+ if (constant is ConstructedConstantValue) {
+ if (constant.type.element == classElement) {
+ assert(constant.fields.length == 1 || constant.fields.length == 2);
+ ConstantValue indexConstant = constant.fields.values.first;
+ if (indexConstant is IntConstantValue) {
+ return indexConstant.primitiveValue;
+ }
+ }
+ }
+ return null;
+ }
+
+ ConstantValue getConstantValue(ir.Expression node,
+ {bool requireConstant: true, bool implicitNull: false}) {
+ ConstantExpression constant;
+ if (node == null) {
+ if (!implicitNull) {
+ throw new SpannableAssertionFailure(
+ CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
+ }
+ constant = new NullConstantExpression();
+ } else {
+ constant =
+ new Constantifier(this, requireConstant: requireConstant).visit(node);
+ }
+ if (constant == null) {
+ if (requireConstant) {
+ throw new UnsupportedError(
+ 'No constant for ${DebugPrinter.prettyPrint(node)}');
+ }
+ return null;
+ }
+ return computeConstantValue(constant, requireConstant: requireConstant);
+ }
+
+ /// Converts [annotations] into a list of [ConstantValue]s.
+ List<ConstantValue> getMetadata(List<ir.Expression> annotations) {
+ if (annotations.isEmpty) return const <ConstantValue>[];
+ List<ConstantValue> metadata = <ConstantValue>[];
+ annotations.forEach((ir.Expression node) {
+ metadata.add(getConstantValue(node));
+ });
+ return metadata;
+ }
+}
+
+abstract class KernelToElementMapForImpactMixin
+ implements KernelToElementMapForImpact, KernelToElementMapBaseMixin {
+ DiagnosticReporter get reporter;
+ native.BehaviorBuilder get nativeBehaviorBuilder;
+
+ /// Returns `true` is [node] has a `@Native(...)` annotation.
+ // TODO(johnniwinther): Cache this for later use.
+ bool isNativeClass(ir.Class node) {
+ for (ir.Expression annotation in node.annotations) {
+ if (annotation is ir.ConstructorInvocation) {
+ FunctionEntity target = getConstructor(annotation.target);
+ if (target.enclosingClass == commonElements.nativeAnnotationClass) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /// Compute the kind of foreign helper function called by [node], if any.
+ ForeignKind getForeignKind(ir.StaticInvocation node) {
+ if (isForeignLibrary(node.target.enclosingLibrary)) {
+ switch (node.target.name.name) {
+ case JavaScriptBackend.JS:
+ return ForeignKind.JS;
+ case JavaScriptBackend.JS_BUILTIN:
+ return ForeignKind.JS_BUILTIN;
+ case JavaScriptBackend.JS_EMBEDDED_GLOBAL:
+ return ForeignKind.JS_EMBEDDED_GLOBAL;
+ case JavaScriptBackend.JS_INTERCEPTOR_CONSTANT:
+ return ForeignKind.JS_INTERCEPTOR_CONSTANT;
+ }
+ }
+ return ForeignKind.NONE;
+ }
+
/// Computes the [InterfaceType] referenced by a call to the
/// [JS_INTERCEPTOR_CONSTANT] function, if any.
InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node) {
@@ -530,7 +387,10 @@ abstract class KernelToElementMapMixin
type, metadata, typeLookup(resolveAsRaw: false),
isJsInterop: isJsInterop);
}
+}
+abstract class KernelToElementMapForBuildingMixin
+ implements KernelToElementMapForBuilding, KernelToElementMapBaseMixin {
@override
FunctionEntity getSuperNoSuchMethod(ClassEntity cls) {
while (cls != null) {
@@ -556,14 +416,6 @@ abstract class KernelToElementMapMixin
return function;
}
- js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
- int index = _extractEnumIndexFromConstantValue(
- constant, commonElements.jsGetNameEnum);
- if (index == null) return null;
- return namer.getNameForJsGetName(
- CURRENT_ELEMENT_SPANNABLE, JsGetName.values[index]);
- }
-
js.Template getJsBuiltinTemplate(
ConstantValue constant, CodeEmitterTask emitter) {
int index = _extractEnumIndexFromConstantValue(
@@ -571,20 +423,6 @@ abstract class KernelToElementMapMixin
if (index == null) return null;
return emitter.builtinTemplateFor(JsBuiltin.values[index]);
}
-
- int _extractEnumIndexFromConstantValue(
- ConstantValue constant, ClassEntity classElement) {
- if (constant is ConstructedConstantValue) {
- if (constant.type.element == classElement) {
- assert(constant.fields.length == 1 || constant.fields.length == 2);
- ConstantValue indexConstant = constant.fields.values.first;
- if (indexConstant is IntConstantValue) {
- return indexConstant.primitiveValue;
- }
- }
- }
- return null;
- }
}
/// Visitor that converts string literals and concatenations of string literals
@@ -609,11 +447,11 @@ class Stringifier extends ir.ExpressionVisitor<String> {
/// [ConstantExpression].
class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
final bool requireConstant;
- final KernelToElementMapMixin elementAdapter;
+ final KernelToElementMapBaseMixin elementMap;
- Constantifier(this.elementAdapter, {this.requireConstant: true});
+ Constantifier(this.elementMap, {this.requireConstant: true});
- CommonElements get _commonElements => elementAdapter.commonElements;
+ CommonElements get _commonElements => elementMap.commonElements;
ConstantExpression visit(ir.Expression node) {
ConstantExpression constant = node.accept(this);
@@ -662,10 +500,9 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
List<ConstantExpression> expressions = _computeArguments(arguments);
if (expressions == null) return null;
return new ConstructedConstantExpression(
- elementAdapter.createInterfaceType(
- target.enclosingClass, arguments.types),
- elementAdapter.getConstructor(target),
- elementAdapter.getCallStructure(arguments),
+ elementMap.createInterfaceType(target.enclosingClass, arguments.types),
+ elementMap.getConstructor(target),
+ elementMap.getCallStructure(arguments),
expressions);
}
@@ -695,10 +532,10 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
ConstantExpression visitStaticGet(ir.StaticGet node) {
ir.Member target = node.target;
if (target is ir.Field && target.isConst) {
- return new FieldConstantExpression(elementAdapter.getField(node.target));
+ return new FieldConstantExpression(elementMap.getField(node.target));
} else if (node.target is ir.Procedure) {
- FunctionEntity function = elementAdapter.getMethod(node.target);
- DartType type = elementAdapter.getFunctionType(node.target.function);
+ FunctionEntity function = elementMap.getMethod(node.target);
+ DartType type = elementMap.getFunctionType(node.target.function);
return new FunctionConstantExpression(function, type);
}
return defaultExpression(node);
@@ -746,8 +583,8 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
if (!node.isConst) {
return defaultExpression(node);
}
- DartType keyType = elementAdapter.getDartType(node.keyType);
- DartType valueType = elementAdapter.getDartType(node.valueType);
+ DartType keyType = elementMap.getDartType(node.keyType);
+ DartType valueType = elementMap.getDartType(node.valueType);
List<ConstantExpression> keys = <ConstantExpression>[];
List<ConstantExpression> values = <ConstantExpression>[];
for (ir.MapEntry entry in node.entries) {
@@ -767,7 +604,7 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
if (!node.isConst) {
return defaultExpression(node);
}
- DartType elementType = elementAdapter.getDartType(node.typeArgument);
+ DartType elementType = elementMap.getDartType(node.typeArgument);
List<ConstantExpression> values = <ConstantExpression>[];
for (ir.Expression expression in node.expressions) {
ConstantExpression value = visit(expression);
@@ -780,7 +617,7 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
@override
ConstantExpression visitTypeLiteral(ir.TypeLiteral node) {
- DartType type = elementAdapter.getDartType(node.type);
+ DartType type = elementMap.getDartType(node.type);
String name;
if (type.isDynamic) {
name = 'dynamic';
@@ -860,7 +697,7 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
@override
ConstantExpression visitStaticInvocation(ir.StaticInvocation node) {
- MemberEntity member = elementAdapter.getMember(node.target);
+ MemberEntity member = elementMap.getMember(node.target);
if (member == _commonElements.identicalFunction) {
if (node.arguments.positional.length == 2 &&
node.arguments.named.isEmpty) {
@@ -944,8 +781,8 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
ConstantConstructor computeConstantConstructor(ir.Constructor node) {
assert(node.isConst);
ir.Class cls = node.enclosingClass;
- InterfaceType type = elementAdapter.elementEnvironment
- .getThisType(elementAdapter.getClass(cls));
+ InterfaceType type =
+ elementMap.elementEnvironment.getThisType(elementMap.getClass(cls));
Map<dynamic, ConstantExpression> defaultValues =
<dynamic, ConstantExpression>{};
@@ -977,7 +814,7 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
<FieldEntity, ConstantExpression>{};
void registerField(ir.Field field, ConstantExpression constant) {
- fieldMap[elementAdapter.getField(field)] = constant;
+ fieldMap[elementMap.getField(field)] = constant;
}
if (!isRedirecting) {
@@ -1013,122 +850,3 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
}
}
}
-
-/// Interface for type inference results for kernel IR nodes.
-abstract class KernelToTypeInferenceMap {
- /// Returns the inferred return type of [function].
- TypeMask getReturnTypeOf(FunctionEntity function);
-
- /// Returns the inferred receiver type of the dynamic [invocation].
- TypeMask typeOfInvocation(
- ir.MethodInvocation invocation, ClosedWorld closedWorld);
-
- /// Returns the inferred receiver type of the dynamic [read].
- TypeMask typeOfGet(ir.PropertyGet read);
-
- /// Returns the inferred receiver type of the dynamic [write].
- TypeMask typeOfSet(ir.PropertySet write, ClosedWorld closedWorld);
-
- /// Returns the inferred type of [listLiteral].
- TypeMask typeOfListLiteral(covariant MemberEntity owner,
- ir.ListLiteral listLiteral, ClosedWorld closedWorld);
-
- /// Returns the inferred type of iterator in [forInStatement].
- TypeMask typeOfIterator(ir.ForInStatement forInStatement);
-
- /// Returns the inferred type of `current` in [forInStatement].
- TypeMask typeOfIteratorCurrent(ir.ForInStatement forInStatement);
-
- /// Returns the inferred type of `moveNext` in [forInStatement].
- TypeMask typeOfIteratorMoveNext(ir.ForInStatement forInStatement);
-
- /// Returns `true` if [forInStatement] is inferred to be a JavaScript
- /// indexable iterator.
- bool isJsIndexableIterator(
- ir.ForInStatement forInStatement, ClosedWorld closedWorld);
-
- /// Returns `true` if [mask] is inferred to have a JavaScript `length`
- /// property.
- bool isFixedLength(TypeMask mask, ClosedWorld closedWorld);
-
- /// Returns the inferred index type of [forInStatement].
- TypeMask inferredIndexType(ir.ForInStatement forInStatement);
-
- /// Returns the inferred type of [member].
- TypeMask getInferredTypeOf(MemberEntity member);
-
- /// Returns the inferred type of the [parameter].
- TypeMask getInferredTypeOfParameter(Local parameter);
-
- /// Returns the inferred type of a dynamic [selector] access on a receiver of
- /// type [mask].
- TypeMask selectorTypeOf(Selector selector, TypeMask mask);
-
- /// Returns the returned type annotation in the [nativeBehavior].
- TypeMask typeFromNativeBehavior(
- native.NativeBehavior nativeBehavior, ClosedWorld closedWorld);
-}
-
-/// Map from kernel IR nodes to local entities.
-abstract class KernelToLocalsMap {
- /// The member currently being built.
- MemberEntity get currentMember;
-
- // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from
- // now on.
- /// Call to notify that [member] is currently being inlined.
- void enterInlinedMember(covariant MemberEntity member);
-
- /// Call to notify that [member] is no longer being inlined.
- void leaveInlinedMember(covariant MemberEntity member);
-
- /// Returns the [Local] for [node].
- Local getLocal(ir.VariableDeclaration node);
-
- /// Returns the [JumpTarget] for the break statement [node].
- JumpTarget getJumpTargetForBreak(ir.BreakStatement node);
-
- /// Returns `true` if [node] should generate a `continue` to its [JumpTarget].
- bool generateContinueForBreak(ir.BreakStatement node);
-
- /// Returns the [JumpTarget] defined by the labelled statement [node] or
- /// `null` if [node] is not a jump target.
- JumpTarget getJumpTargetForLabel(ir.LabeledStatement node);
-
- /// Returns the [JumpTarget] defined by the switch statement [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForSwitch(ir.SwitchStatement node);
-
- /// Returns the [JumpTarget] for the continue switch statement [node].
- JumpTarget getJumpTargetForContinueSwitch(ir.ContinueSwitchStatement node);
-
- /// Returns the [JumpTarget] defined by the switch case [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForSwitchCase(ir.SwitchCase node);
-
- /// Returns the [JumpTarget] defined the do statement [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForDo(ir.DoStatement node);
-
- /// Returns the [JumpTarget] defined by the for statement [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForFor(ir.ForStatement node);
-
- /// Returns the [JumpTarget] defined by the for-in statement [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForForIn(ir.ForInStatement node);
-
- /// Returns the [JumpTarget] defined by the while statement [node] or `null`
- /// if [node] is not a jump target.
- JumpTarget getJumpTargetForWhile(ir.WhileStatement node);
-
- /// Returns the [LoopClosureScope] for the loop [node] in [closureClassMaps].
- LoopClosureScope getLoopClosureScope(
- ClosureDataLookup closureLookup, ir.TreeNode node);
-}
-
-/// Comparator for the canonical order or named arguments.
-// TODO(johnniwinther): Remove this when named parameters are sorted in dill.
-int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) {
- return a.name.compareTo(b.name);
-}
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698