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( |