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

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

Issue 2950213002: Infer the return types of local functions where appropriate. (Closed)
Patch Set: Created 3 years, 6 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 507f21c8133b31c3883dc98923bbcf7fbfccd8ec..99f2340a4c1b29e52282b052513723bc81333277 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -2432,10 +2432,14 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
FunctionNode function = pop();
exitLocalScope();
var declaration = pop();
- var returnType = pop() ?? const DynamicType();
+ var returnType = pop();
+ var hasImplicitReturnType = returnType == null;
+ returnType ??= const DynamicType();
pop(); // Modifiers.
exitFunction();
if (declaration is FunctionDeclaration) {
+ KernelFunctionDeclaration.setHasImplicitReturnType(
+ declaration, hasImplicitReturnType);
function.returnType = returnType;
declaration.variable.type = function.functionType;
declaration.function = function;

Powered by Google App Engine
This is Rietveld 408576698