ast: Remove no-arg constructor for ast::LoopStatement
In a near-future change, AST nodes, such as ast::BlockStatement will no longer be std::unique_ptrs, and will have to be constructed and owned by an external class. This means AST nodes can no longer allocate default child nodes. Bug: tint:322 Change-Id: I3db9b3c037896f07b84b14b7b8d4da0f066b69b0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32679 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
b29b09fba6
commit
6a788df30e
|
@ -17,11 +17,6 @@
|
|||
namespace tint {
|
||||
namespace ast {
|
||||
|
||||
LoopStatement::LoopStatement()
|
||||
: Statement(),
|
||||
body_(std::make_unique<BlockStatement>()),
|
||||
continuing_(std::make_unique<BlockStatement>()) {}
|
||||
|
||||
LoopStatement::LoopStatement(std::unique_ptr<BlockStatement> body,
|
||||
std::unique_ptr<BlockStatement> continuing)
|
||||
: Statement(), body_(std::move(body)), continuing_(std::move(continuing)) {}
|
||||
|
|
|
@ -27,8 +27,6 @@ namespace ast {
|
|||
/// A loop statement
|
||||
class LoopStatement : public Statement {
|
||||
public:
|
||||
/// Constructor
|
||||
LoopStatement();
|
||||
/// Constructor
|
||||
/// @param body the body statements
|
||||
/// @param continuing the continuing statements
|
||||
|
|
|
@ -58,7 +58,7 @@ TEST_F(LoopStatementTest, Creation_WithSource) {
|
|||
}
|
||||
|
||||
TEST_F(LoopStatementTest, IsLoop) {
|
||||
LoopStatement l;
|
||||
LoopStatement l(create<BlockStatement>(), create<BlockStatement>());
|
||||
EXPECT_TRUE(l.IsLoop());
|
||||
}
|
||||
|
||||
|
|
|
@ -2207,7 +2207,10 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
|
|||
}
|
||||
|
||||
bool FunctionEmitter::EmitLoopStart(const Construct* construct) {
|
||||
auto* loop = AddStatement(std::make_unique<ast::LoopStatement>())->AsLoop();
|
||||
auto* loop = AddStatement(std::make_unique<ast::LoopStatement>(
|
||||
std::make_unique<ast::BlockStatement>(),
|
||||
std::make_unique<ast::BlockStatement>()))
|
||||
->AsLoop();
|
||||
PushNewStatementBlock(
|
||||
construct, construct->end_id,
|
||||
[loop](StatementBlock* s) { loop->set_body(std::move(s->statements_)); });
|
||||
|
|
|
@ -40,7 +40,8 @@ TEST_F(BuilderTest, Loop_Empty) {
|
|||
// loop {
|
||||
// }
|
||||
|
||||
ast::LoopStatement expr;
|
||||
ast::LoopStatement expr(create<ast::BlockStatement>(),
|
||||
create<ast::BlockStatement>());
|
||||
|
||||
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
|
||||
b.push_function(Function{});
|
||||
|
|
Loading…
Reference in New Issue