diff --git a/src/ast/else_statement.cc b/src/ast/else_statement.cc index d181caa4b1..f21614418a 100644 --- a/src/ast/else_statement.cc +++ b/src/ast/else_statement.cc @@ -17,9 +17,6 @@ namespace tint { namespace ast { -ElseStatement::ElseStatement() - : Statement(), body_(std::make_unique()) {} - ElseStatement::ElseStatement(std::unique_ptr body) : Statement(), body_(std::move(body)) {} diff --git a/src/ast/else_statement.h b/src/ast/else_statement.h index c79ffb8a2e..5fb38010ed 100644 --- a/src/ast/else_statement.h +++ b/src/ast/else_statement.h @@ -29,8 +29,6 @@ namespace ast { /// An else statement class ElseStatement : public Statement { public: - /// Constructor - ElseStatement(); /// Constructor /// @param body the else body explicit ElseStatement(std::unique_ptr body); diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc index b8ae12ac71..826648ef7c 100644 --- a/src/ast/else_statement_test.cc +++ b/src/ast/else_statement_test.cc @@ -51,7 +51,7 @@ TEST_F(ElseStatementTest, Creation_WithSource) { } TEST_F(ElseStatementTest, IsElse) { - ElseStatement e; + ElseStatement e(create()); EXPECT_TRUE(e.IsElse()); } @@ -64,12 +64,12 @@ TEST_F(ElseStatementTest, HasCondition) { } TEST_F(ElseStatementTest, HasContition_NullCondition) { - ElseStatement e; + ElseStatement e(create()); EXPECT_FALSE(e.HasCondition()); } TEST_F(ElseStatementTest, IsValid) { - ElseStatement e; + ElseStatement e(create()); EXPECT_TRUE(e.IsValid()); } diff --git a/src/ast/if_statement_test.cc b/src/ast/if_statement_test.cc index d63368b0ad..20141ad826 100644 --- a/src/ast/if_statement_test.cc +++ b/src/ast/if_statement_test.cc @@ -70,9 +70,9 @@ TEST_F(IfStatementTest, IsValid_WithElseStatements) { body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("Ident")); - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); IfStatement stmt(std::move(cond), std::move(body)); stmt.set_else_statements(std::move(else_stmts)); @@ -122,9 +122,9 @@ TEST_F(IfStatementTest, IsValid_NullElseStatement) { body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("Ident")); - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts.push_back(nullptr); IfStatement stmt(std::move(cond), std::move(body)); @@ -138,7 +138,7 @@ TEST_F(IfStatementTest, IsValid_InvalidElseStatement) { body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("")); IfStatement stmt(std::move(cond), std::move(body)); @@ -152,8 +152,8 @@ TEST_F(IfStatementTest, IsValid_MultipleElseWiththoutCondition) { body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); + else_stmts.push_back(create(create())); IfStatement stmt(std::move(cond), std::move(body)); stmt.set_else_statements(std::move(else_stmts)); @@ -166,8 +166,8 @@ TEST_F(IfStatementTest, IsValid_ElseNotLast) { body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); + else_stmts.push_back(create(create())); else_stmts[1]->set_condition(create("ident")); IfStatement stmt(std::move(cond), std::move(body)); @@ -208,10 +208,10 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) { else_body->append(create()); ElseStatementList else_stmts; - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts[0]->set_condition(create("ident")); else_stmts[0]->set_body(std::move(else_if_body)); - else_stmts.push_back(create()); + else_stmts.push_back(create(create())); else_stmts[1]->set_body(std::move(else_body)); IfStatement stmt(std::move(cond), std::move(body));