Convert ShadowDoStatement to DoJudgment.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I221930a21cff1f966465fb9ded227e7eb3d2c9f8
Reviewed-on: https://dart-review.googlesource.com/61080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@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 5cd8e53..4da73f9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -77,7 +77,7 @@
ContinueJudgment,
CheckLibraryIsLoadedJudgment,
ConditionalJudgment,
- ShadowDoStatement,
+ DoJudgment,
ShadowDoubleLiteral,
EmptyStatementJudgment,
ShadowExpressionStatement,
@@ -374,8 +374,7 @@
@override
Statement doStatement(Token doKeyword, Statement body, Token whileKeyword,
Expression condition, Token semicolon) {
- return new ShadowDoStatement(body, condition)
- ..fileOffset = doKeyword.charOffset;
+ return new DoJudgment(body, condition)..fileOffset = doKeyword.charOffset;
}
Statement expressionStatement(Expression expression, Token semicolon) {
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 07639f7..c5a0997 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
@@ -820,20 +820,24 @@
}
/// Concrete shadow object representing a do loop in kernel form.
-class ShadowDoStatement extends DoStatement implements StatementJudgment {
- ShadowDoStatement(Statement body, Expression condition)
- : super(body, condition);
+class DoJudgment extends DoStatement implements StatementJudgment {
+ DoJudgment(Statement body, Expression condition) : super(body, condition);
+
+ StatementJudgment get bodyJudgment => body;
+
+ ExpressionJudgment get conditionJudgment => condition;
@override
void infer<Expression, Statement, Initializer, Type>(
ShadowTypeInferrer inferrer,
Factory<Expression, Statement, Initializer, Type> factory) {
- inferrer.inferStatement(factory, body);
+ var conditionJudgment = this.conditionJudgment;
+ inferrer.inferStatement(factory, bodyJudgment);
var boolType = inferrer.coreTypes.boolClass.rawType;
- var actualType = inferrer.inferExpression(
- factory, condition, boolType, !inferrer.isTopLevel);
- inferrer.ensureAssignable(
- boolType, actualType, condition, condition.fileOffset);
+ inferrer.inferExpression(
+ factory, conditionJudgment, boolType, !inferrer.isTopLevel);
+ inferrer.ensureAssignable(boolType, conditionJudgment.inferredType,
+ condition, condition.fileOffset);
}
}