Move Switch validation from Validator to Resolver

* Formerly, we reported the same error message if we detected no default
clause or more than one. I made it so that we output a different error
message for each. This makes it more clear, and in the case of more than
one, the error source location points at the second default clause,
rather than at the switch statement.

* Add functions to ProgramBuilder to more easily define switch and case
statements.

* Fix broken tests as a result of this change.

Bug: tint:642
Change-Id: Iab4e610a563165862d9bc190772d32a4dd24ac45
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45880
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2021-03-25 12:55:27 +00:00
committed by Commit Bot service account
parent 0f5c26d5fd
commit cea744d558
12 changed files with 229 additions and 248 deletions

View File

@@ -170,6 +170,7 @@ source_set("tint_unittests_core_src") {
"../src/program_test.cc",
"../src/resolver/assignment_validation_test.cc",
"../src/resolver/builtins_validation_test.cc",
"../src/resolver/control_block_validation_test.cc",
"../src/resolver/decoration_validation_test.cc",
"../src/resolver/function_validation_test.cc",
"../src/resolver/host_shareable_validation_test.cc",
@@ -218,7 +219,6 @@ source_set("tint_unittests_core_src") {
"../src/utils/tmpfile.h",
"../src/utils/tmpfile_test.cc",
"../src/utils/unique_vector_test.cc",
"../src/validator/validator_control_block_test.cc",
"../src/validator/validator_decoration_test.cc",
"../src/validator/validator_function_test.cc",
"../src/validator/validator_test.cc",