tint: Refactor if-else statement representation

Instead of using an `if` node that has a list of `else` statements,
make each `if` statement have a single optional `else` statement,
which may itself be an `if` statement (or just a block statement).

This better matches the WGSL grammar (now that we have removed
`elseif`), and simplifies various pieces of code that handle these
statements.

Change-Id: Ie4272f1422224490ac598a03aa8b4dd00ba03010
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
James Price
2022-04-29 00:14:53 +00:00
committed by Dawn LUCI CQ
parent 68e039c456
commit 26ebe5ec36
53 changed files with 392 additions and 940 deletions

View File

@@ -24,13 +24,11 @@ sem::IfStatement {
sem::BlockStatement {
statement_a
}
sem::ElseStatement {
sem::IfStatement {
condition_b
sem::BlockStatement {
statement_b
}
}
sem::ElseStatement {
sem::BlockStatement {
statement_c
}