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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2877253003: Don't type promote local functions. (Closed)
Patch Set: Created 3 years, 7 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/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 6b0610f3f82c64fbd829bbe7195b5fc3e415956d..6952a9e4cabf501efd725ffe43d8b34c0cb21193 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -14,7 +14,7 @@ import '../parser/identifier_context.dart' show IdentifierContext;
import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory;
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
- show KernelArguments, KernelField;
+ show KernelArguments, KernelField, KernelFunctionDeclaration;
import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken;
@@ -2042,8 +2042,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
Identifier name = pop();
VariableDeclaration variable = astFactory.variableDeclaration(
name.name, name.token, functionNestingLevel,
- isFinal: true);
- push(new FunctionDeclaration(
+ isFinal: true, isLocalFunction: true);
+ push(new KernelFunctionDeclaration(
variable, new FunctionNode(new InvalidStatement()))
..fileOffset = beginToken.charOffset);
scope[variable.name] = new KernelVariableBuilder(
@@ -2102,6 +2102,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
exitLocalScope();
FunctionDeclaration declaration = pop();
function.returnType = pop() ?? const DynamicType();
+ declaration.variable.type = function.functionType;
pop(); // Modifiers.
exitFunction();
declaration.function = function;
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/ast_factory.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698