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

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

Issue 2359453002: Handle local functions 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
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 fef8f82a6282ad237893285a679b9207ed255810..f03bd1f61372d7b4ae273ad2d6e43e6eb6ff3e92 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -244,10 +244,17 @@ class KernelImpactBuilder extends ir.Visitor {
@override
void visitMethodInvocation(ir.MethodInvocation invocation) {
- invocation.receiver.accept(this);
+ var receiver = invocation.receiver;
+ if (receiver is ir.VariableGet &&
+ receiver.variable.isFinal &&
+ receiver.variable.parent is ir.FunctionDeclaration) {
+ // Invocation of a local function. No need for dynamic use.
+ } else {
+ invocation.receiver.accept(this);
+ impactBuilder.registerDynamicUse(
+ new DynamicUse(astAdapter.getSelector(invocation), null));
+ }
_visitArguments(invocation.arguments);
- impactBuilder.registerDynamicUse(
- new DynamicUse(astAdapter.getSelector(invocation), null));
}
@override
@@ -280,5 +287,12 @@ class KernelImpactBuilder extends ir.Visitor {
}
@override
+ void visitFunctionDeclaration(ir.FunctionDeclaration node) {
+ impactBuilder
+ .registerStaticUse(new StaticUse.closure(astAdapter.getElement(node)));
+ node.visitChildren(this);
+ }
+
+ @override
void defaultNode(ir.Node node) => node.visitChildren(this);
}

Powered by Google App Engine
This is Rietveld 408576698