sem: Replace SwitchCaseBlockStatement with CaseStatement

The SwitchCaseBlockStatement was bound to the BlockStatement of an ast::CaseStatement, but we had nothing that mapped to the actual ast::CaseStatement.
sem::CaseStatement replaces sem::SwitchCaseBlockStatement, and has a Block() accessor, providing a superset of the old behavior.

With this, we can now easily validate the `fallthrough` rules directly, instead of scanning the switch case. This keeps the validation more tigtly coupled to the ast / sem nodes.

Change-Id: I0f22eba37bb164b9e071a6166c7a41fc1a5ac532
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71460
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-12-03 15:23:52 +00:00
committed by Tint LUCI CQ
parent 8e39ffd512
commit bf39c8fb19
9 changed files with 103 additions and 55 deletions

View File

@@ -105,11 +105,15 @@ Semantic tree:
```
sem::SwitchStatement {
sem::Expression condition
sem::SwitchCaseBlockStatement {
sem::Statement statement_a
sem::CaseStatement {
sem::BlockStatement {
sem::Statement statement_a
}
}
sem::SwitchCaseBlockStatement {
sem::Statement statement_b
sem::CaseStatement {
sem::BlockStatement {
sem::Statement statement_b
}
}
}
```