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

Unified Diff: lib/compiler/implementation/universe/universe.dart

Issue 11315005: Fix for issue #6259: also look for subclasses when checking if a typed selector applies to an eleme… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « no previous file | tests/language/typed_selector_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | tests/language/typed_selector_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698