ast: Remove no-arg constructor for ast::CastStatement

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: I2a571d0a4727d6dc3d6c38e8b6602e131292f49c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32676
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-11-16 14:25:27 +00:00
committed by Commit Bot service account
parent e5e9617220
commit 4ad0019df0
11 changed files with 15 additions and 28 deletions

View File

@@ -2150,7 +2150,8 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
for (size_t i = last_clause_index;; --i) {
// Create the case clause. Temporarily put it in the wrong order
// on the case statement list.
cases->emplace_back(std::make_unique<ast::CaseStatement>());
cases->emplace_back(std::make_unique<ast::CaseStatement>(
std::make_unique<ast::BlockStatement>()));
auto* clause = cases->back().get();
// Create a list of integer literals for the selector values leading to
@@ -2189,8 +2190,7 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
// Generate a default clause with a just fallthrough.
auto stmts = std::make_unique<ast::BlockStatement>();
stmts->append(std::make_unique<ast::FallthroughStatement>());
auto case_stmt = std::make_unique<ast::CaseStatement>();
case_stmt->set_body(std::move(stmts));
auto case_stmt = std::make_unique<ast::CaseStatement>(std::move(stmts));
cases->emplace_back(std::move(case_stmt));
}

View File

@@ -1653,7 +1653,8 @@ Maybe<std::unique_ptr<ast::CaseStatement>> ParserImpl::switch_body() {
auto source = t.source();
next(); // Consume the peek
auto stmt = std::make_unique<ast::CaseStatement>();
auto stmt = std::make_unique<ast::CaseStatement>(
std::make_unique<ast::BlockStatement>());
stmt->set_source(source);
if (t.IsCase()) {
auto selectors = expect_case_selectors();