Update IfExpression to follow AST conventions (#1167)

This commit is contained in:
Geoff Romer
2022-04-12 12:28:48 -07:00
committed by GitHub
parent baf832b18b
commit 883f2a3ecd
6 changed files with 31 additions and 35 deletions
+6 -12
View File
@@ -174,18 +174,12 @@ static auto ExpressionToProto(const Expression& expression)
case ExpressionKind::IfExpression: {
const auto& if_expression = cast<IfExpression>(expression);
auto* if_proto = expression_proto.mutable_if_expression();
if (if_expression.condition()) {
*if_proto->mutable_condition() =
ExpressionToProto(*if_expression.condition());
}
if (if_expression.then_expression()) {
*if_proto->mutable_then_expression() =
ExpressionToProto(*if_expression.then_expression());
}
if (if_expression.else_expression()) {
*if_proto->mutable_else_expression() =
ExpressionToProto(*if_expression.else_expression());
}
*if_proto->mutable_condition() =
ExpressionToProto(if_expression.condition());
*if_proto->mutable_then_expression() =
ExpressionToProto(if_expression.then_expression());
*if_proto->mutable_else_expression() =
ExpressionToProto(if_expression.else_expression());
break;
}