Use FunctionNodeJudgment in FunctionExpressionJudgment.

We don't need changes to NamedFunctionExpressionJudgment, because it is
a wrapper around FunctionExpressionJudgment.

Change-Id: Ia94fb3201c7a960a64af2fdeaa8d8307ba6d82c3
Reviewed-on: https://dart-review.googlesource.com/61980
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 7eb3524..ed98771 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1342,13 +1342,11 @@
   void infer<Expression, Statement, Initializer, Type>(
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory,
-      bool hasImplicitReturnType,
+      DartType typeContext,
+      DartType returnContext,
       int returnTypeInstrumentationOffset) {
-    DartType returnContext = hasImplicitReturnType
-        ? (inferrer.strongMode ? null : const DynamicType())
-        : returnType;
-    inferrer.inferLocalFunction(
-        factory, this, null, returnTypeInstrumentationOffset, returnContext);
+    inferrer.inferLocalFunction(factory, this, typeContext,
+        returnTypeInstrumentationOffset, returnContext);
   }
 }
 
@@ -1359,7 +1357,7 @@
   bool _hasImplicitReturnType = false;
 
   FunctionDeclarationJudgment(
-      VariableDeclarationJudgment variable, FunctionNode function)
+      VariableDeclarationJudgment variable, FunctionNodeJudgment function)
       : super(variable, function);
 
   VariableDeclarationJudgment get variableJudgment => variable;
@@ -1371,8 +1369,10 @@
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory) {
     inferrer.inferMetadataKeepingHelper(factory, variable.annotations);
-    functionJudgment.infer(
-        inferrer, factory, _hasImplicitReturnType, fileOffset);
+    DartType returnContext = _hasImplicitReturnType
+        ? (inferrer.strongMode ? null : const DynamicType())
+        : function.returnType;
+    functionJudgment.infer(inferrer, factory, null, returnContext, fileOffset);
     var inferredType = variable.type = function.functionType;
     inferrer.listener.functionDeclaration(
         variableJudgment.createBinder(inferrer), inferredType);
@@ -1389,15 +1389,18 @@
     implements ExpressionJudgment {
   DartType inferredType;
 
-  FunctionExpressionJudgment(FunctionNode function) : super(function);
+  FunctionExpressionJudgment(FunctionNodeJudgment function) : super(function);
+
+  FunctionNodeJudgment get judgment => function;
 
   @override
   DartType infer<Expression, Statement, Initializer, Type>(
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory,
       DartType typeContext) {
-    inferredType = inferrer.inferLocalFunction(
-        factory, function, typeContext, fileOffset, null);
+    var judgment = this.judgment;
+    judgment.infer(inferrer, factory, typeContext, null, fileOffset);
+    inferredType = judgment.functionType;
     inferrer.listener.functionExpression(this, fileOffset, inferredType);
     return inferredType;
   }