Index: pkg/compiler/lib/src/ssa/kernel_impact.dart |
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart |
index 4da2b684f4de47b5d1293d501cc3dc322f111dac..6accc0fa947f377c19a660e25e789f25e6d86f7b 100644 |
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart |
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart |
@@ -195,8 +195,24 @@ class KernelImpactBuilder extends ir.Visitor { |
void visitStaticInvocation(ir.StaticInvocation invocation) { |
_visitArguments(invocation.arguments); |
Element target = astAdapter.getElement(invocation.target).declaration; |
- impactBuilder.registerStaticUse(new StaticUse.staticInvoke( |
- target, astAdapter.getCallStructure(invocation.arguments))); |
+ if (target.isFactoryConstructor) { |
+ impactBuilder.registerStaticUse(new StaticUse.constructorInvoke( |
+ target, astAdapter.getCallStructure(invocation.arguments))); |
+ // TODO(johnniwinther): We should not mark the type as instantiated but |
+ // rather follow the type arguments directly. |
Harry Terkelsen
2016/09/16 16:58:30
What do you mean by "follow the type arguments"? I
Johnni Winther
2016/09/19 08:10:18
Consider this:
abstract class A<T> {
factory A.
|
+ ClassElement cls = |
+ astAdapter.getElement(invocation.target.enclosingClass); |
+ List<DartType> typeArguments = |
+ astAdapter.getDartTypes(invocation.arguments.types); |
+ impactBuilder.registerTypeUse( |
+ new TypeUse.instantiation(new InterfaceType(cls, typeArguments))); |
+ if (typeArguments.any((DartType type) => !type.isDynamic)) { |
+ impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); |
+ } |
+ } else { |
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke( |
+ target, astAdapter.getCallStructure(invocation.arguments))); |
+ } |
} |
@override |