For loop for arrays (#1753)

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
pmqtt
2022-08-09 15:34:24 -07:00
committed by GitHub
co-authored by m new Geoff Romer Richard Smith
parent 2c921efe36
commit f754373786
23 changed files with 361 additions and 4 deletions
+10
View File
@@ -521,6 +521,16 @@ static auto StatementToProto(const Statement& statement) -> Fuzzing::Statement {
// Initializes with the default value; there's nothing to set.
statement_proto.mutable_continue_statement();
break;
case StatementKind::For: {
const auto& for_stmt = cast<For>(statement);
auto* for_proto = statement_proto.mutable_for_statement();
*for_proto->mutable_var_decl() =
BindingPatternToProto(for_stmt.variable_declaration());
*for_proto->mutable_target() = ExpressionToProto(for_stmt.loop_target());
*for_proto->mutable_body() = BlockStatementToProto(for_stmt.body());
break;
}
}
return statement_proto;
}