Index: sdk/lib/_internal/compiler/implementation/enqueue.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart |
index 1036a57eb779e6d256f3c1da586785959dd3f464..2e6eb201b7bf20fe7095693b28e211567e89ce38 100644 |
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart |
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart |
@@ -61,6 +61,15 @@ abstract class Enqueuer { |
if (!addElementToWorkList(element, elements)) return; |
+ if (element.isFactoryConstructor()) { |
+ ClassElement cls = element.getEnclosingClass(); |
+ // For factories (and instantiations of [List]), the target is abstract. |
+ // Since we may need the type arguments for constructing the instance, |
+ // we register the class to be added to the classes needing rti. |
+ compiler.world.registerUsedFactoriesOfAbstractClasses(cls); |
+ compiler.backend.registerSetRuntimeType(); |
ngeoffray
2013/02/27 12:36:28
This (registerSetRuntimeType) should be done elsew
karlklose
2013/02/27 16:11:32
Obsolete.
|
+ } |
+ |
// Enable runtime type support if we discover a getter called runtimeType. |
// We have to enable runtime type before hitting the codegen, so |
// that constructors know whether they need to generate code for |
@@ -86,6 +95,11 @@ abstract class Enqueuer { |
// the work list'? |
bool addElementToWorkList(Element element, [TreeElements elements]); |
+ void registerInstantiatedType(InterfaceType type) { |
+ universe.instantiatedTypes.add(type); |
+ registerInstantiatedClass(type.element); |
+ } |
+ |
void registerInstantiatedClass(ClassElement cls) { |
if (universe.instantiatedClasses.contains(cls)) return; |
if (!cls.isAbstract(compiler)) { |