Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart (revision 27025) |
| +++ sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart (working copy) |
| @@ -496,8 +496,9 @@ |
| } |
| bool needsNoSuchMethodHandling(Selector selector, Compiler compiler) { |
| - // A call on an empty type mask is dead code. |
| - if (isEmpty && !isNullable) return false; |
| + // A call on an empty type mask is either dead code, or a call on |
| + // `null`. |
| + if (isEmpty) return false; |
| // A call on an exact mask for an abstract class is dead code. |
| if (isExact && base.element.isAbstract(compiler)) return false; |
| // If the receiver is guaranteed to have a member that |
| @@ -541,7 +542,25 @@ |
| // If we're calling bar on an object of type A we do need the |
| // handler because we may have to call B.noSuchMethod since B |
| // does not implement bar. |
| - return !willHit(selector, compiler); |
| + |
| + Element cls = base.element; |
| + bool hasMatch = hasConcreteMatch(cls, selector, compiler); |
| + if (isExact) return !hasMatch; |
| + if (!cls.isAbstract(compiler) && !hasMatch) return true; |
| + |
| + Set<ClassElement> subtypesToCheck; |
| + if (isSubtype) { |
| + subtypesToCheck = compiler.world.subtypesOf(cls); |
| + } else { |
| + assert(isSubclass); |
| + subtypesToCheck = compiler.world.subclassesOf(cls); |
| + } |
| + |
| + return subtypesToCheck != null |
| + && subtypesToCheck.any((ClassElement cls) { |
| + return !cls.isAbstract(compiler) |
|
ahe
2013/09/04 12:17:49
Why the check for isAbstract?
ngeoffray
2013/09/04 12:32:23
If an abstract class does not have a concrete matc
ahe
2013/09/04 12:39:54
Thank you. Add a comment?
|
| + && !hasConcreteMatch(cls, selector, compiler); |
| + }); |
| } |
| Element locateSingleElement(Selector selector, Compiler compiler) { |