Introduce semantic::Info

Will hold the mutable fields that currently reside in the otherwise immutable-AST.

Change the AST string methods to accept a `const semantic::Info&`. This is required as some nodes include type-resolved information in their output strings.

Bug: tint:390
Change-Id: Iba494a9c5645ce2096da0a8cfe63a4309a9d9c3c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39003
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-01-29 10:55:40 +00:00
committed by Commit Bot service account
parent 63049a420e
commit dd1b6fca9f
174 changed files with 1105 additions and 827 deletions

View File

@@ -360,9 +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()
: selector->As<ast::SintLiteral>()->to_str();
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: '" +