Rename Constant::As to Constant::ValueAs.

This CL updates Constant::As to be Constant::ValueAs. Now that Constant
inherits from CastableBase, there is already an As method on
CastableBase. This makes the override inside Constant confusing and
potentially incorrect.

Bug: tint:1718
Change-Id: I4f73971801e95225a99a5a993124c04194d0d7d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114360
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2022-12-14 20:46:32 +00:00
committed by Dawn LUCI CQ
parent 35842190ef
commit 5addefb148
20 changed files with 401 additions and 401 deletions

View File

@@ -559,7 +559,7 @@ struct DirectVariableAccess::State {
const ast::Expression* BuildDynamicIndex(const sem::Expression* idx, bool cast_to_u32) {
if (auto* val = idx->ConstantValue()) {
// Expression evaluated to a constant value. Just emit that constant.
return b.Expr(val->As<AInt>());
return b.Expr(val->ValueAs<AInt>());
}
// Expression is not a constant, clone the expression.

View File

@@ -545,7 +545,7 @@ struct Std140::State {
[&](const sem::IndexAccessorExpression* a) {
// Array, matrix or vector index.
if (auto* val = a->Index()->ConstantValue()) {
access.indices.Push(val->As<u32>());
access.indices.Push(val->ValueAs<u32>());
} else {
access.indices.Push(DynamicIndex{access.dynamic_indices.Length()});
access.dynamic_indices.Push(a->Index());

View File

@@ -405,7 +405,7 @@ struct ZeroInitWorkgroupMemory::State {
}
auto* sem = ctx.src->Sem().Get(expr);
if (auto* c = sem->ConstantValue()) {
workgroup_size_const *= c->As<AInt>();
workgroup_size_const *= c->ValueAs<AInt>();
continue;
}
// Constant value could not be found. Build expression instead.