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

Unified Diff: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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: 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)) {

Powered by Google App Engine
This is Rietveld 408576698