Add semantic::Statement::Block() for getting the owning BlockStatement

Required special casing the ElseStatement, as this isn't actually owned by a BlockStatement.

Change-Id: Ic33c207598b838a12b865a7694e596b2629c9208
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46443
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-03-31 20:35:46 +00:00
committed by Commit Bot service account
parent 285b8b6e75
commit dba65b7a34
8 changed files with 99 additions and 49 deletions

View File

@@ -65,6 +65,9 @@ class BlockStatement : public Castable<BlockStatement, Statement> {
/// @returns the ending iterator
StatementList::const_iterator end() const { return statements_.end(); }
/// @returns the statement list
const StatementList& statements() const { return statements_; }
/// Clones this node and all transitive child nodes using the `CloneContext`
/// `ctx`.
/// @param ctx the clone context