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

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

Issue 2392943003: Handle const constructor invocation in kernel_impact. (Closed)
Patch Set: Updated cf. comments. Created 4 years, 2 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: 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 ed0516763a300dba1a5bab37077c4d496bfc0ffb..25bdb78d8517fce40627eabaf9dfeba9463231f5 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -15,6 +15,7 @@ import '../kernel/kernel.dart';
import '../kernel/kernel_debug.dart';
import '../kernel/kernel_visitor.dart';
import '../resolution/registry.dart' show ResolutionWorldImpactBuilder;
+import '../universe/call_structure.dart';
import '../universe/feature.dart';
import '../universe/selector.dart';
import '../universe/use.dart';
@@ -215,19 +216,21 @@ class KernelImpactBuilder extends ir.Visitor {
@override
void visitConstructorInvocation(ir.ConstructorInvocation node) {
- handleNew(node, node.target);
+ handleNew(node, node.target, isConst: node.isConst);
}
- void handleNew(ir.InvocationExpression node, ir.Member target) {
+ void handleNew(ir.InvocationExpression node, ir.Member target,
+ {bool isConst: false}) {
_visitArguments(node.arguments);
Element element = astAdapter.getElement(target).declaration;
- impactBuilder.registerStaticUse(new StaticUse.constructorInvoke(
- element, astAdapter.getCallStructure(node.arguments)));
ClassElement cls = astAdapter.getElement(target.enclosingClass);
List<DartType> typeArguments =
astAdapter.getDartTypes(node.arguments.types);
- impactBuilder.registerTypeUse(
- new TypeUse.instantiation(new InterfaceType(cls, typeArguments)));
+ InterfaceType type = new InterfaceType(cls, typeArguments);
+ CallStructure callStructure = astAdapter.getCallStructure(node.arguments);
+ impactBuilder.registerStaticUse(isConst
+ ? new StaticUse.constConstructorInvoke(element, callStructure, type)
+ : new StaticUse.typedConstructorInvoke(element, callStructure, type));
if (typeArguments.any((DartType type) => !type.isDynamic)) {
impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
}
« no previous file with comments | « pkg/compiler/lib/src/serialization/impact_serialization.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698