mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
sem: Add CompoundStatement
This change introduces sem::CompoundStatement, a new base class for statements that can hold other statements. sem::BlockStatements now derives from sem::CompoundStatement, and this change introduces the following new CompoundStatements: * `sem::IfStatement` * `sem::ElseStatement` * `sem::ForLoopStatement` * `sem::LoopStatement` * `sem::SwitchStatement`. These new CompoundStatements are now inserted into the semantic tree as now documented in `docs/compound_statements.md`. The `sem::BlockStatement::FindFirstParent()` methods have been moved down to `sem::Statement`. The `Resolver::BlockScope()` method has been replaced with `Resolver::Scope()` which now maintains the `current_statement_`, `current_compound_statement_ ` and `current_block_`. This simplifies statement nesting. The most significant change in behavior is that statements now always have a parent, so calling Block() on the initializer or continuing of a for-loop statement will now return the BlockStatement that holds the for-loop. Before this would return nullptr. Fixed: tint:979 Change-Id: I90e38fd719da2a281ed9210e975ab96171cb6842 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57707 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
3e27a20f31
commit
6e459fecb7
@@ -229,10 +229,10 @@ tint_unittests_source_set("tint_unittests_core_src") {
|
||||
"../src/resolver/assignment_validation_test.cc",
|
||||
"../src/resolver/atomics_test.cc",
|
||||
"../src/resolver/atomics_validation_test.cc",
|
||||
"../src/resolver/block_test.cc",
|
||||
"../src/resolver/builtins_validation_test.cc",
|
||||
"../src/resolver/call_test.cc",
|
||||
"../src/resolver/call_validation_test.cc",
|
||||
"../src/resolver/compound_statement_test.cc",
|
||||
"../src/resolver/control_block_validation_test.cc",
|
||||
"../src/resolver/decoration_validation_test.cc",
|
||||
"../src/resolver/entry_point_validation_test.cc",
|
||||
|
||||
Reference in New Issue
Block a user