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

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

Issue 2359453002: Handle local functions in kernel_impact. (Closed)
Patch Set: Updated cf. comments. 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 15efe23e8b2da8e019c868e3dae9b1b49672008c..f03bd1f61372d7b4ae273ad2d6e43e6eb6ff3e92 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -5,6 +5,7 @@
import 'package:kernel/ast.dart' as ir;
import '../common.dart';
+import '../common/names.dart';
import '../compiler.dart';
import '../constants/expressions.dart';
import '../dart_types.dart';
@@ -243,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
@@ -265,11 +273,6 @@ class KernelImpactBuilder extends ir.Visitor {
}
@override
- void visitNot(ir.Not not) {
- not.operand.accept(this);
- }
-
- @override
void visitAssertStatement(ir.AssertStatement node) {
impactBuilder.registerFeature(
node.message != null ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT);
@@ -277,5 +280,19 @@ class KernelImpactBuilder extends ir.Visitor {
}
@override
+ void visitStringConcatenation(ir.StringConcatenation node) {
+ impactBuilder.registerFeature(Feature.STRING_INTERPOLATION);
+ impactBuilder.registerFeature(Feature.STRING_JUXTAPOSITION);
+ node.visitChildren(this);
+ }
+
+ @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);
}
« 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