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

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 | lib/compiler/implementation/world.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 14186)
+++ lib/compiler/implementation/universe/universe.dart (working copy)
@@ -526,7 +526,21 @@
}
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 13:15:21 superclass is one word.
ngeoffray 2012/10/29 13:35:18 Done.
+ // [TypedSelector] are only used when compiling.
+ assert(compiler.phase == Compiler.PHASE_COMPILING);
+ Set<ClassElement> typesImplementedBySubclasses =
+ compiler.world.typesImplementedBySubclasses[superClass];
ahe 2012/10/29 13:15:21 I'm concerned by the direct use of maps. Could you
ngeoffray 2012/10/29 13:35:18 Done.
+ if (typesImplementedBySubclasses == null) return false;
+ return typesImplementedBySubclasses.contains(receiverType);
+ }
+
+ if (other.implementsInterface(self)
+ || other.isSubclassOf(self)
+ || hasOneSubclassThatImplements(other)) {
return appliesUntyped(element, compiler);
}
« no previous file with comments | « no previous file | lib/compiler/implementation/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698