Convert ShadowConditionalExpression to ConditionalJudgment.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ica4d3e2b432eb369ad4330b73150146e3144a066
Reviewed-on: https://dart-review.googlesource.com/60832
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
index 6144cc9..473b73f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -75,7 +75,7 @@
         BoolJudgment,
         ShadowBreakStatement,
         CheckLibraryIsLoadedJudgment,
-        ShadowConditionalExpression,
+        ConditionalJudgment,
         ShadowDoStatement,
         ShadowDoubleLiteral,
         EmptyStatementJudgment,
@@ -360,8 +360,7 @@
   @override
   Expression conditionalExpression(Expression condition, Token question,
       Expression thenExpression, Token colon, Expression elseExpression) {
-    return new ShadowConditionalExpression(
-        condition, thenExpression, elseExpression)
+    return new ConditionalJudgment(condition, thenExpression, elseExpression)
       ..fileOffset = offsetForToken(question);
   }
 
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 5833f1e..0b51139 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
@@ -611,11 +611,17 @@
 
 /// Concrete shadow object representing a conditional expression in kernel form.
 /// Shadow object for [ConditionalExpression].
-class ShadowConditionalExpression extends ConditionalExpression
+class ConditionalJudgment extends ConditionalExpression
     implements ExpressionJudgment {
   DartType inferredType;
 
-  ShadowConditionalExpression(
+  ExpressionJudgment get conditionJudgment => condition;
+
+  ExpressionJudgment get thenJudgment => then;
+
+  ExpressionJudgment get otherwiseJudgment => otherwise;
+
+  ConditionalJudgment(
       Expression condition, Expression then, Expression otherwise)
       : super(condition, then, otherwise, null);
 
@@ -624,24 +630,25 @@
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory,
       DartType typeContext) {
+    var conditionJudgment = this.conditionJudgment;
+    var thenJudgment = this.thenJudgment;
+    var otherwiseJudgment = this.otherwiseJudgment;
     var expectedType = inferrer.coreTypes.boolClass.rawType;
-    var conditionType = inferrer.inferExpression(
-        factory, condition, expectedType, !inferrer.isTopLevel);
-    inferrer.ensureAssignable(
-        expectedType, conditionType, condition, condition.fileOffset);
-    DartType thenType =
-        inferrer.inferExpression(factory, then, typeContext, true);
+    inferrer.inferExpression(
+        factory, conditionJudgment, expectedType, !inferrer.isTopLevel);
+    inferrer.ensureAssignable(expectedType, conditionJudgment.inferredType,
+        condition, condition.fileOffset);
+    inferrer.inferExpression(factory, thenJudgment, typeContext, true);
     bool useLub = _forceLub || typeContext == null;
-    DartType otherwiseType =
-        inferrer.inferExpression(factory, otherwise, typeContext, useLub);
-    DartType type = useLub
-        ? inferrer.typeSchemaEnvironment
-            .getLeastUpperBound(thenType, otherwiseType)
+    inferrer.inferExpression(factory, otherwiseJudgment, typeContext, useLub);
+    inferredType = useLub
+        ? inferrer.typeSchemaEnvironment.getLeastUpperBound(
+            thenJudgment.inferredType, otherwiseJudgment.inferredType)
         : greatestClosure(inferrer.coreTypes, typeContext);
     if (inferrer.strongMode) {
-      staticType = type;
+      staticType = inferredType;
     }
-    return type;
+    return inferredType;
   }
 }