Replace Type::(Is|As)Array with Castable

Change-Id: I8d9b916f5977121380325d373c4e2f805b691fae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34264
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-11-30 23:30:58 +00:00
parent 67864267c2
commit af37c4ae83
34 changed files with 118 additions and 125 deletions

View File

@@ -86,8 +86,8 @@ bool ValidatorImpl::ValidateConstructedTypes(
if (ct->IsStruct()) {
auto* st = ct->AsStruct();
for (auto* member : st->impl()->members()) {
if (member->type()->UnwrapAll()->IsArray()) {
auto* r = member->type()->UnwrapAll()->AsArray();
if (member->type()->UnwrapAll()->Is<ast::type::ArrayType>()) {
auto* r = member->type()->UnwrapAll()->As<ast::type::ArrayType>();
if (r->IsRuntimeArray()) {
if (member != st->impl()->members().back()) {
add_error(member->source(), "v-0015",
@@ -263,8 +263,12 @@ bool ValidatorImpl::ValidateDeclStatement(
return false;
}
variable_stack_.set(name, decl->variable());
if (decl->variable()->type()->UnwrapAll()->IsArray()) {
if (decl->variable()->type()->UnwrapAll()->AsArray()->IsRuntimeArray()) {
if (decl->variable()->type()->UnwrapAll()->Is<ast::type::ArrayType>()) {
if (decl->variable()
->type()
->UnwrapAll()
->As<ast::type::ArrayType>()
->IsRuntimeArray()) {
add_error(decl->source(), "v-0015",
"runtime arrays may only appear as the last "
"member of a struct: '" +