Chromium Code Reviews| Index: lib/compiler/implementation/universe/universe.dart |
| =================================================================== |
| --- lib/compiler/implementation/universe/universe.dart (revision 14125) |
| +++ lib/compiler/implementation/universe/universe.dart (working copy) |
| @@ -523,7 +523,23 @@ |
| } |
| ClassElement self = receiverType.element; |
| - if (other.implementsInterface(self) || other.isSubclassOf(self)) { |
| + |
| + // Checks if a subclass of [superClass] implements [self]. If one |
| + // is found, [element] is a candidate. |
| + bool hasOneSubclassThatImplements(ClassElement superClass) { |
|
ahe
2012/10/29 06:18:29
Have you measured the compile-time impact of this?
|
| + // [TypedSelector] are only used when compiling. |
| + assert(compiler.phase == Compiler.PHASE_COMPILING); |
| + Set<ClassElement> subclasses = compiler.world.subtypes[superClass]; |
| + if (subclasses == null) return false; |
| + for (ClassElement cls in subclasses) { |
| + if (cls.implementsInterface(self)) return true; |
| + } |
| + return false; |
| + } |
| + |
| + if (other.implementsInterface(self) |
| + || other.isSubclassOf(self) |
| + || hasOneSubclassThatImplements(other)) { |
| return appliesUntyped(element, compiler); |
| } |