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

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

Issue 2558633002: Now also support FunctionDeclarations instead of just closures. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 45f6914ae8e806bf84ee0bebfa1787bfee4f91b3..c4936864a013d00b42f097feaadb43364c084019 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -141,6 +141,9 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
} else if (target is ir.FunctionExpression) {
target = (target as ir.FunctionExpression).function;
buildFunctionNode(target);
+ } else if (target is ir.FunctionDeclaration) {
+ target = (target as ir.FunctionDeclaration).function;
+ buildFunctionNode(target);
sra1 2016/12/06 23:26:15 why not: buildFunctionNode(target.function); you
} else {
throw 'No case implemented to handle $target';
}
@@ -1650,8 +1653,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
@override
- void visitFunctionExpression(ir.FunctionExpression funcExpression) {
- LocalFunctionElement methodElement = astAdapter.getElement(funcExpression);
+ visitFunctionNode(ir.FunctionNode node) {
+ LocalFunctionElement methodElement = astAdapter.getElement(node);
ClosureClassMap nestedClosureData = compiler.closureToClassMapper
.getClosureToClassMapping(methodElement.resolvedAst);
assert(nestedClosureData != null);
@@ -1680,6 +1683,22 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
registry?.registerInstantiatedClosure(methodElement);
}
+ @override
+ visitFunctionDeclaration(ir.FunctionDeclaration declaration) {
+ assert(isReachable);
+ declaration.function.accept(this);
+ LocalFunctionElement localFunction = astAdapter.getElement(
+ declaration.function);
+ //LocalFunctionElement localFunction =
+ // elements.getFunctionDefinition(declaration.function);
sra1 2016/12/06 23:26:15 comment
+ localsHandler.updateLocal(localFunction, pop());
+ }
+
+ @override
+ void visitFunctionExpression(ir.FunctionExpression funcExpression) {
+ funcExpression.function.accept(this);
+ }
+
// TODO(het): Decide when to inline
@override
void visitMethodInvocation(ir.MethodInvocation invocation) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698