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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_impact.dart

Issue 2341263002: Handle generic factory constructors in kernel_impact (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698