Index: sdk/lib/_internal/compiler/implementation/world.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/world.dart b/sdk/lib/_internal/compiler/implementation/world.dart |
index 19a3aaf757cecdb65455ff73478e8402870a823d..7bd6ee22afb0c1256fe05da7613d6579504973c9 100644 |
--- a/sdk/lib/_internal/compiler/implementation/world.dart |
+++ b/sdk/lib/_internal/compiler/implementation/world.dart |
@@ -79,12 +79,31 @@ class World { |
} |
} |
+ Set<ClassElement> classesUsingTypeVariableTests = new Set<ClassElement>(); |
compiler.resolverWorld.isChecks.forEach((DartType type) { |
- if (type is InterfaceType) { |
+ if (type.kind == TypeKind.TYPE_VARIABLE) { |
+ TypeVariableElement variable = type.element; |
+ classesUsingTypeVariableTests.add(variable.enclosingElement); |
+ } |
+ }); |
+ // Add is-checks that result from classes using type variables in checks. |
+ compiler.resolverWorld.addImplicitChecks(classesUsingTypeVariableTests); |
+ // Add the rti dependencies that are implicit in the way the backend |
+ // generates code: when we create a new [List], we actually create |
+ // a JSArray in the backend and we need to add type arguments to |
+ // the calls of the list constructor whenever we determine that |
+ // JSArray needs type arguments. |
+ compiler.backend.addBackendRtiDependencies(this); |
+ // Compute the set of all classes that need runtime type information. |
+ compiler.resolverWorld.isChecks.forEach((DartType type) { |
+ if (type.kind == TypeKind.INTERFACE) { |
InterfaceType itf = type; |
if (!itf.isRaw) { |
potentiallyAddForRti(itf.element); |
} |
+ } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
+ TypeVariableElement variable = type.element; |
+ potentiallyAddForRti(variable.enclosingElement); |
} |
}); |
} |
@@ -102,7 +121,6 @@ class World { |
return uses != null && !uses.isEmpty; |
} |
- |
void registerRtiDependency(Element element, Element dependency) { |
// We're not dealing with typedef for now. |
if (!element.isClass() || !dependency.isClass()) return; |