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

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

Issue 2936063002: Handle named mixin application in emitter (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
Index: pkg/compiler/lib/src/kernel/element_map_impl.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 7a29d03b2f46b094cf3dfd842cd14270c79edbb6..2b52e87b0aeef29f49bb249f3952c5240fbddbe9 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -524,6 +524,7 @@ class KernelToElementMapImpl extends KernelToElementMapMixin {
if (node.supertype == null) {
env.orderedTypeSet = new OrderedTypeSet.singleton(env.thisType);
+ env.isMixinApplication = false;
} else {
InterfaceType processSupertype(ir.Supertype node) {
InterfaceType type = _typeConverter.visitSupertype(node);
@@ -537,8 +538,11 @@ class KernelToElementMapImpl extends KernelToElementMapMixin {
LinkBuilder<InterfaceType> linkBuilder =
new LinkBuilder<InterfaceType>();
if (node.mixedInType != null) {
+ env.isMixinApplication = true;
linkBuilder
.addLast(env.mixedInType = processSupertype(node.mixedInType));
+ } else {
+ env.isMixinApplication = false;
}
node.implementedTypes.forEach((ir.Supertype supertype) {
linkBuilder.addLast(processSupertype(supertype));
@@ -581,6 +585,12 @@ class KernelToElementMapImpl extends KernelToElementMapMixin {
return env.supertype;
}
+ bool _isMixinApplication(KClass cls) {
+ _KClassEnv env = _classEnvs[cls.classIndex];
+ _ensureSupertypes(cls, env);
+ return env.isMixinApplication;
+ }
+
bool _isUnnamedMixinApplication(KClass cls) {
_KClassEnv env = _classEnvs[cls.classIndex];
_ensureSupertypes(cls, env);
@@ -871,6 +881,7 @@ class _KLibraryEnv {
/// Environment for fast lookup of class members.
class _KClassEnv {
final ir.Class cls;
+ bool isMixinApplication;
final bool isUnnamedMixinApplication;
InterfaceType thisType;
@@ -1140,11 +1151,25 @@ class KernelElementEnvironment implements ElementEnvironment {
return getThisType(cls).typeArguments.isNotEmpty;
}
+ @override
+ bool isMixinApplication(KClass cls) {
+ return elementMap._isMixinApplication(cls);
+ }
+
@override
bool isUnnamedMixinApplication(KClass cls) {
return elementMap._isUnnamedMixinApplication(cls);
}
+ @override
+ ClassEntity getEffectiveMixinClass(ClassEntity cls) {
+ if (!isMixinApplication(cls)) return null;
+ do {
+ cls = elementMap._getAppliedMixin(cls);
+ } while (isMixinApplication(cls));
+ return cls;
+ }
+
@override
DartType getTypeVariableBound(TypeVariableEntity typeVariable) {
throw new UnimplementedError(
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | pkg/compiler/lib/src/kernel/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698