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

Unified Diff: lib/compiler/implementation/world.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
Index: lib/compiler/implementation/world.dart
===================================================================
--- lib/compiler/implementation/world.dart (revision 14186)
+++ lib/compiler/implementation/world.dart (working copy)
@@ -7,6 +7,7 @@
class World {
final Compiler compiler;
final Map<ClassElement, Set<ClassElement>> subtypes;
+ final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses;
final Set<ClassElement> classesNeedingRti;
final Map<ClassElement, Set<ClassElement>> rtiDependencies;
final FunctionSet userDefinedGetters;
@@ -14,6 +15,8 @@
World(Compiler compiler)
: subtypes = new Map<ClassElement, Set<ClassElement>>(),
+ typesImplementedBySubclasses =
+ new Map<ClassElement, Set<ClassElement>>(),
userDefinedGetters = new FunctionSet(compiler),
userDefinedSetters = new FunctionSet(compiler),
classesNeedingRti = new Set<ClassElement>(),
@@ -26,11 +29,23 @@
compiler.internalErrorOnElement(
cls, 'Class "${cls.name.slowToString()}" is not resolved.');
}
+
for (DartType type in cls.allSupertypes) {
Set<Element> subtypesOfCls =
subtypes.putIfAbsent(type.element, () => new Set<ClassElement>());
subtypesOfCls.add(cls);
}
+
+ // Walk through the superclasses, and record the types
+ // implemented by that type on the superclasses.
+ DartType type = cls.supertype;
+ while (type != null) {
+ Set<Element> typesImplementedBySubclassesOfCls =
+ typesImplementedBySubclasses.putIfAbsent(
+ type.element, () => new Set<ClassElement>());
+ typesImplementedBySubclassesOfCls.addAll(cls.allSupertypes);
+ type = type.element.supertype;
+ }
}
compiler.resolverWorld.instantiatedClasses.forEach(addSubtypes);

Powered by Google App Engine
This is Rietveld 408576698