mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
Simplify calls to ast::Node::[to_]str()
Add helpers on Program and ProgramBuilder that significantly simplify usage. Also demangle - this also reduces a bunch of copy-pasta code. Change-Id: I6215c346e7f6e49c20aced058a6150603253ed93 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39342 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
dd1b6fca9f
commit
708dc2d040
@@ -360,14 +360,10 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) {
|
||||
? selector->As<ast::UintLiteral>()->value()
|
||||
: selector->As<ast::SintLiteral>()->value());
|
||||
if (selector_set.count(v)) {
|
||||
auto v_str =
|
||||
selector->type()->Is<type::U32>()
|
||||
? selector->As<ast::UintLiteral>()->to_str(program_->Sem())
|
||||
: selector->As<ast::SintLiteral>()->to_str(program_->Sem());
|
||||
add_error(case_stmt->source(), "v-0027",
|
||||
"a literal value must not appear more than once in "
|
||||
"the case selectors for a switch statement: '" +
|
||||
v_str + "'");
|
||||
program_->str(selector) + "'");
|
||||
return false;
|
||||
}
|
||||
selector_set.emplace(v);
|
||||
|
||||
Reference in New Issue
Block a user