mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
reader/spirv: Remove use of BlockStatement::append()
Introduce `StatementBuilder`s , which may hold mutable state, before being converted into the immutable AST node on completion of the `BlockStatement`. Bug: tint:396 Bug: tint:390 Change-Id: I0381c4ae7948be0de02bc13e54e0037a72baaf0c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35506 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
2353bd0d3d
commit
b833f1572b
@@ -24,6 +24,10 @@ namespace ast {
|
||||
|
||||
BlockStatement::BlockStatement(const Source& source) : Base(source) {}
|
||||
|
||||
BlockStatement::BlockStatement(const Source& source,
|
||||
const StatementList& statements)
|
||||
: Base(source), statements_(std::move(statements)) {}
|
||||
|
||||
BlockStatement::BlockStatement(BlockStatement&&) = default;
|
||||
|
||||
BlockStatement::~BlockStatement() = default;
|
||||
|
||||
@@ -30,6 +30,10 @@ class BlockStatement : public Castable<BlockStatement, Statement> {
|
||||
/// Constructor
|
||||
/// @param source the block statement source
|
||||
explicit BlockStatement(const Source& source);
|
||||
/// Constructor
|
||||
/// @param source the block statement source
|
||||
/// @param statements the block statements
|
||||
BlockStatement(const Source& source, const StatementList& statements);
|
||||
/// Move constructor
|
||||
BlockStatement(BlockStatement&&);
|
||||
~BlockStatement() override;
|
||||
|
||||
@@ -42,6 +42,9 @@ class Statement : public Castable<Statement, Node> {
|
||||
Statement(const Statement&) = delete;
|
||||
};
|
||||
|
||||
/// A list of statements
|
||||
using StatementList = std::vector<Statement*>;
|
||||
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
|
||||
Reference in New Issue
Block a user