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

@@ -163,7 +163,6 @@ tint_unittests_source_set("tint_unittests_ast_src") {
"../../src/tint/ast/depth_multisampled_texture_test.cc",
"../../src/tint/ast/depth_texture_test.cc",
"../../src/tint/ast/discard_statement_test.cc",
"../../src/tint/ast/else_statement_test.cc",
"../../src/tint/ast/enable_test.cc",
"../../src/tint/ast/external_texture_test.cc",
"../../src/tint/ast/f32_test.cc",
@@ -486,7 +485,6 @@ tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
"../../src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc",
"../../src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc",
"../../src/tint/reader/wgsl/parser_impl_depth_texture_test.cc",
"../../src/tint/reader/wgsl/parser_impl_elseif_stmt_test.cc",
"../../src/tint/reader/wgsl/parser_impl_enable_directive_test.cc",
"../../src/tint/reader/wgsl/parser_impl_equality_expression_test.cc",
"../../src/tint/reader/wgsl/parser_impl_error_msg_test.cc",