Rename type::Array to type::ArrayType

This is to avoid name conflicts once we move all classes from namespace
`type` to `sem`.

Bug: tint:724
Change-Id: Icc3d81ae62eb3b329ce28e78a23ea27f29c9263b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48360
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano 2021-04-19 21:13:12 +00:00 committed by Commit Bot service account
parent e94237dcdd
commit cf4057be01
44 changed files with 179 additions and 166 deletions

View File

@ -82,7 +82,7 @@ ResourceBinding::SampledKind BaseTypeToSampledKind(type::Type* base_type) {
return ResourceBinding::SampledKind::kUnknown; return ResourceBinding::SampledKind::kUnknown;
} }
if (auto* at = base_type->As<type::Array>()) { if (auto* at = base_type->As<type::ArrayType>()) {
base_type = at->type(); base_type = at->type();
} else if (auto* mt = base_type->As<type::Matrix>()) { } else if (auto* mt = base_type->As<type::Matrix>()) {
base_type = mt->type(); base_type = mt->type();

View File

@ -645,13 +645,13 @@ class InspectorHelper : public ProgramBuilder {
return *inspector_; return *inspector_;
} }
type::Array* u32_array_type(uint32_t count) { type::ArrayType* u32_array_type(uint32_t count) {
if (array_type_memo_.find(count) == array_type_memo_.end()) { if (array_type_memo_.find(count) == array_type_memo_.end()) {
array_type_memo_[count] = array_type_memo_[count] =
create<type::Array>(ty.u32(), count, create<type::ArrayType>(ty.u32(), count,
ast::DecorationList{ ast::DecorationList{
create<ast::StrideDecoration>(4), create<ast::StrideDecoration>(4),
}); });
} }
return array_type_memo_[count]; return array_type_memo_[count];
} }
@ -671,7 +671,7 @@ class InspectorHelper : public ProgramBuilder {
std::unique_ptr<Inspector> inspector_; std::unique_ptr<Inspector> inspector_;
type::Sampler sampler_type_; type::Sampler sampler_type_;
type::Sampler comparison_sampler_type_; type::Sampler comparison_sampler_type_;
std::map<uint32_t, type::Array*> array_type_memo_; std::map<uint32_t, type::ArrayType*> array_type_memo_;
std::map<std::tuple<type::Type*, uint32_t>, type::Vector*> vector_type_memo_; std::map<std::tuple<type::Type*, uint32_t>, type::Vector*> vector_type_memo_;
}; };

View File

@ -404,7 +404,7 @@ class ArrayBuilder : public Builder {
: element_builder_(element_builder) {} : element_builder_(element_builder) {}
bool MatchUnwrapped(MatchState& state, type::Type* ty) const override { bool MatchUnwrapped(MatchState& state, type::Type* ty) const override {
if (auto* arr = ty->As<type::Array>()) { if (auto* arr = ty->As<type::ArrayType>()) {
if (arr->size() == 0) { if (arr->size() == 0) {
return element_builder_->Match(state, arr->type()); return element_builder_->Match(state, arr->type());
} }
@ -414,7 +414,7 @@ class ArrayBuilder : public Builder {
type::Type* Build(BuildState& state) const override { type::Type* Build(BuildState& state) const override {
auto* el = element_builder_->Build(state); auto* el = element_builder_->Build(state);
return state.ty_mgr.Get<type::Array>(el, 0, ast::DecorationList{}); return state.ty_mgr.Get<type::ArrayType>(el, 0, ast::DecorationList{});
} }
std::string str() const override { std::string str() const override {

View File

@ -490,16 +490,19 @@ class ProgramBuilder {
/// @param subtype the array element type /// @param subtype the array element type
/// @param n the array size. 0 represents a runtime-array. /// @param n the array size. 0 represents a runtime-array.
/// @return the tint AST type for a array of size `n` of type `T` /// @return the tint AST type for a array of size `n` of type `T`
type::Array* array(type::Type* subtype, uint32_t n = 0) const { type::ArrayType* array(type::Type* subtype, uint32_t n = 0) const {
return builder->create<type::Array>(subtype, n, ast::DecorationList{}); return builder->create<type::ArrayType>(subtype, n,
ast::DecorationList{});
} }
/// @param subtype the array element type /// @param subtype the array element type
/// @param n the array size. 0 represents a runtime-array. /// @param n the array size. 0 represents a runtime-array.
/// @param stride the array stride. /// @param stride the array stride.
/// @return the tint AST type for a array of size `n` of type `T` /// @return the tint AST type for a array of size `n` of type `T`
type::Array* array(type::Type* subtype, uint32_t n, uint32_t stride) const { type::ArrayType* array(type::Type* subtype,
return builder->create<type::Array>( uint32_t n,
uint32_t stride) const {
return builder->create<type::ArrayType>(
subtype, n, subtype, n,
ast::DecorationList{ ast::DecorationList{
builder->create<ast::StrideDecoration>(stride), builder->create<ast::StrideDecoration>(stride),
@ -508,14 +511,14 @@ class ProgramBuilder {
/// @return the tint AST type for an array of size `N` of type `T` /// @return the tint AST type for an array of size `N` of type `T`
template <typename T, int N = 0> template <typename T, int N = 0>
type::Array* array() const { type::ArrayType* array() const {
return array(Of<T>(), N); return array(Of<T>(), N);
} }
/// @param stride the array stride /// @param stride the array stride
/// @return the tint AST type for an array of size `N` of type `T` /// @return the tint AST type for an array of size `N` of type `T`
template <typename T, int N = 0> template <typename T, int N = 0>
type::Array* array(uint32_t stride) const { type::ArrayType* array(uint32_t stride) const {
return array(Of<T>(), N, stride); return array(Of<T>(), N, stride);
} }

View File

@ -762,7 +762,7 @@ type::Type* ParserImpl::ConvertType(
if (!ParseArrayDecorations(rtarr_ty, &decorations)) { if (!ParseArrayDecorations(rtarr_ty, &decorations)) {
return nullptr; return nullptr;
} }
return create<type::Array>(ast_elem_ty, 0, std::move(decorations)); return create<type::ArrayType>(ast_elem_ty, 0, std::move(decorations));
} }
type::Type* ParserImpl::ConvertType( type::Type* ParserImpl::ConvertType(
@ -807,8 +807,8 @@ type::Type* ParserImpl::ConvertType(
if (remap_buffer_block_type_.count(elem_type_id)) { if (remap_buffer_block_type_.count(elem_type_id)) {
remap_buffer_block_type_.insert(type_mgr_->GetId(arr_ty)); remap_buffer_block_type_.insert(type_mgr_->GetId(arr_ty));
} }
return create<type::Array>(ast_elem_ty, static_cast<uint32_t>(num_elem), return create<type::ArrayType>(ast_elem_ty, static_cast<uint32_t>(num_elem),
std::move(decorations)); std::move(decorations));
} }
bool ParserImpl::ParseArrayDecorations( bool ParserImpl::ParseArrayDecorations(
@ -1493,7 +1493,7 @@ ast::Expression* ParserImpl::MakeNullValue(type::Type* type) {
return create<ast::TypeConstructorExpression>(Source{}, type, return create<ast::TypeConstructorExpression>(Source{}, type,
std::move(ast_components)); std::move(ast_components));
} }
if (auto* arr_ty = type->As<type::Array>()) { if (auto* arr_ty = type->As<type::ArrayType>()) {
ast::ExpressionList ast_components; ast::ExpressionList ast_components;
for (size_t i = 0; i < arr_ty->size(); ++i) { for (size_t i = 0; i < arr_ty->size(); ++i) {
ast_components.emplace_back(MakeNullValue(arr_ty->type())); ast_components.emplace_back(MakeNullValue(arr_ty->type()));

View File

@ -326,8 +326,8 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray) {
auto* type = p->ConvertType(10); auto* type = p->ConvertType(10);
ASSERT_NE(type, nullptr); ASSERT_NE(type, nullptr);
EXPECT_TRUE(type->Is<type::Array>()); EXPECT_TRUE(type->Is<type::ArrayType>());
auto* arr_type = type->As<type::Array>(); auto* arr_type = type->As<type::ArrayType>();
EXPECT_TRUE(arr_type->IsRuntimeArray()); EXPECT_TRUE(arr_type->IsRuntimeArray());
ASSERT_NE(arr_type, nullptr); ASSERT_NE(arr_type, nullptr);
EXPECT_EQ(arr_type->size(), 0u); EXPECT_EQ(arr_type->size(), 0u);
@ -361,7 +361,7 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_Valid) {
EXPECT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(10); auto* type = p->ConvertType(10);
ASSERT_NE(type, nullptr); ASSERT_NE(type, nullptr);
auto* arr_type = type->As<type::Array>(); auto* arr_type = type->As<type::ArrayType>();
EXPECT_TRUE(arr_type->IsRuntimeArray()); EXPECT_TRUE(arr_type->IsRuntimeArray());
ASSERT_NE(arr_type, nullptr); ASSERT_NE(arr_type, nullptr);
ASSERT_EQ(arr_type->decorations().size(), 1u); ASSERT_EQ(arr_type->decorations().size(), 1u);
@ -409,8 +409,8 @@ TEST_F(SpvParserTest, ConvertType_Array) {
auto* type = p->ConvertType(10); auto* type = p->ConvertType(10);
ASSERT_NE(type, nullptr); ASSERT_NE(type, nullptr);
EXPECT_TRUE(type->Is<type::Array>()); EXPECT_TRUE(type->Is<type::ArrayType>());
auto* arr_type = type->As<type::Array>(); auto* arr_type = type->As<type::ArrayType>();
EXPECT_FALSE(arr_type->IsRuntimeArray()); EXPECT_FALSE(arr_type->IsRuntimeArray());
ASSERT_NE(arr_type, nullptr); ASSERT_NE(arr_type, nullptr);
EXPECT_EQ(arr_type->size(), 42u); EXPECT_EQ(arr_type->size(), 42u);
@ -496,8 +496,8 @@ TEST_F(SpvParserTest, ConvertType_ArrayStride_Valid) {
auto* type = p->ConvertType(10); auto* type = p->ConvertType(10);
ASSERT_NE(type, nullptr); ASSERT_NE(type, nullptr);
EXPECT_TRUE(type->Is<type::Array>()); EXPECT_TRUE(type->Is<type::ArrayType>());
auto* arr_type = type->As<type::Array>(); auto* arr_type = type->As<type::ArrayType>();
ASSERT_NE(arr_type, nullptr); ASSERT_NE(arr_type, nullptr);
ASSERT_EQ(arr_type->decorations().size(), 1u); ASSERT_EQ(arr_type->decorations().size(), 1u);

View File

@ -1052,7 +1052,7 @@ Expect<type::Type*> ParserImpl::expect_type_decl_array(
size = val.value; size = val.value;
} }
return create<type::Array>(subtype.value, size, std::move(decos)); return create<type::ArrayType>(subtype.value, size, std::move(decos));
}); });
} }

View File

@ -191,8 +191,8 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) {
EXPECT_FALSE(str->IsBlockDecorated()); EXPECT_FALSE(str->IsBlockDecorated());
const auto* ty = str->impl()->members()[0]->type(); const auto* ty = str->impl()->members()[0]->type();
ASSERT_TRUE(ty->Is<type::Array>()); ASSERT_TRUE(ty->Is<type::ArrayType>());
const auto* arr = ty->As<type::Array>(); const auto* arr = ty->As<type::ArrayType>();
ASSERT_EQ(arr->decorations().size(), 1u); ASSERT_EQ(arr->decorations().size(), 1u);
auto* stride = arr->decorations()[0]; auto* stride = arr->decorations()[0];

View File

@ -338,9 +338,9 @@ TEST_F(ParserImplTest, TypeDecl_Array) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_FALSE(a->IsRuntimeArray());
ASSERT_EQ(a->size(), 5u); ASSERT_EQ(a->size(), 5u);
ASSERT_TRUE(a->type()->Is<type::F32>()); ASSERT_TRUE(a->type()->Is<type::F32>());
@ -354,9 +354,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_FALSE(a->IsRuntimeArray());
ASSERT_EQ(a->size(), 5u); ASSERT_EQ(a->size(), 5u);
ASSERT_TRUE(a->type()->Is<type::F32>()); ASSERT_TRUE(a->type()->Is<type::F32>());
@ -374,9 +374,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Stride) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_TRUE(a->IsRuntimeArray()); ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->Is<type::F32>()); ASSERT_TRUE(a->type()->Is<type::F32>());
@ -393,9 +393,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_OneBlock) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_TRUE(a->IsRuntimeArray()); ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->Is<type::F32>()); ASSERT_TRUE(a->type()->Is<type::F32>());
@ -414,9 +414,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_MultipleBlocks) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_TRUE(a->IsRuntimeArray()); ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->Is<type::F32>()); ASSERT_TRUE(a->type()->Is<type::F32>());
@ -517,9 +517,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_TRUE(a->IsRuntimeArray()); ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->Is<type::U32>()); ASSERT_TRUE(a->type()->Is<type::U32>());
} }
@ -531,9 +531,9 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Vec) {
EXPECT_FALSE(t.errored); EXPECT_FALSE(t.errored);
ASSERT_NE(t.value, nullptr) << p->error(); ASSERT_NE(t.value, nullptr) << p->error();
ASSERT_FALSE(p->has_error()); ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->Is<type::Array>()); ASSERT_TRUE(t->Is<type::ArrayType>());
auto* a = t->As<type::Array>(); auto* a = t->As<type::ArrayType>();
ASSERT_TRUE(a->IsRuntimeArray()); ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->is_unsigned_integer_vector()); ASSERT_TRUE(a->type()->is_unsigned_integer_vector());
} }

View File

@ -127,9 +127,10 @@ TEST_P(ArrayDecorationTest, IsValid) {
auto& params = GetParam(); auto& params = GetParam();
ast::StructMemberList members{Member( ast::StructMemberList members{Member(
"a", create<type::Array>(ty.f32(), 0, "a",
ast::DecorationList{createDecoration( create<type::ArrayType>(ty.f32(), 0,
Source{{12, 34}}, *this, params.kind)}))}; ast::DecorationList{createDecoration(
Source{{12, 34}}, *this, params.kind)}))};
auto* s = create<ast::Struct>( auto* s = create<ast::Struct>(
members, ast::DecorationList{create<ast::StructBlockDecoration>()}); members, ast::DecorationList{create<ast::StructBlockDecoration>()});
auto* s_ty = ty.struct_("mystruct", s); auto* s_ty = ty.struct_("mystruct", s);
@ -333,10 +334,10 @@ TEST_P(ArrayStrideTest, All) {
SCOPED_TRACE(ss.str()); SCOPED_TRACE(ss.str());
auto* arr = auto* arr =
create<type::Array>(el_ty, 4, create<type::ArrayType>(el_ty, 4,
ast::DecorationList{ ast::DecorationList{
create<ast::StrideDecoration>(params.stride), create<ast::StrideDecoration>(params.stride),
}); });
Global(Source{{12, 34}}, "myarray", arr, ast::StorageClass::kInput); Global(Source{{12, 34}}, "myarray", arr, ast::StorageClass::kInput);
@ -421,11 +422,11 @@ INSTANTIATE_TEST_SUITE_P(
Params{ty_mat4x4<f32>, (default_mat4x4.align - 1) * 7, false})); Params{ty_mat4x4<f32>, (default_mat4x4.align - 1) * 7, false}));
TEST_F(ArrayStrideTest, MultipleDecorations) { TEST_F(ArrayStrideTest, MultipleDecorations) {
auto* arr = create<type::Array>(ty.i32(), 4, auto* arr = create<type::ArrayType>(ty.i32(), 4,
ast::DecorationList{ ast::DecorationList{
create<ast::StrideDecoration>(4), create<ast::StrideDecoration>(4),
create<ast::StrideDecoration>(4), create<ast::StrideDecoration>(4),
}); });
Global(Source{{12, 34}}, "myarray", arr, ast::StorageClass::kInput); Global(Source{{12, 34}}, "myarray", arr, ast::StorageClass::kInput);

View File

@ -123,7 +123,7 @@ bool Resolver::IsStorable(type::Type* type) {
type->Is<type::Matrix>()) { type->Is<type::Matrix>()) {
return true; return true;
} }
if (type::Array* arr = type->As<type::Array>()) { if (type::ArrayType* arr = type->As<type::ArrayType>()) {
return IsStorable(arr->type()); return IsStorable(arr->type());
} }
if (type::Struct* str = type->As<type::Struct>()) { if (type::Struct* str = type->As<type::Struct>()) {
@ -149,7 +149,7 @@ bool Resolver::IsHostShareable(type::Type* type) {
if (auto* mat = type->As<type::Matrix>()) { if (auto* mat = type->As<type::Matrix>()) {
return IsHostShareable(mat->type()); return IsHostShareable(mat->type());
} }
if (auto* arr = type->As<type::Array>()) { if (auto* arr = type->As<type::ArrayType>()) {
return IsHostShareable(arr->type()); return IsHostShareable(arr->type());
} }
if (auto* str = type->As<type::Struct>()) { if (auto* str = type->As<type::Struct>()) {
@ -228,7 +228,7 @@ bool Resolver::Type(type::Type* ty) {
if (!Structure(str)) { if (!Structure(str)) {
return false; return false;
} }
} else if (auto* arr = ty->As<type::Array>()) { } else if (auto* arr = ty->As<type::ArrayType>()) {
if (!Array(arr, Source{})) { if (!Array(arr, Source{})) {
return false; return false;
} }
@ -248,7 +248,7 @@ Resolver::VariableInfo* Resolver::Variable(ast::Variable* var,
variable_to_info_.emplace(var, info); variable_to_info_.emplace(var, info);
// Resolve variable's type // Resolve variable's type
if (auto* arr = info->type->As<type::Array>()) { if (auto* arr = info->type->As<type::ArrayType>()) {
if (!Array(arr, var->source())) { if (!Array(arr, var->source())) {
return nullptr; return nullptr;
} }
@ -358,7 +358,7 @@ bool Resolver::ValidateGlobalVariable(const VariableInfo* info) {
bool Resolver::ValidateVariable(const ast::Variable* var) { bool Resolver::ValidateVariable(const ast::Variable* var) {
auto* type = variable_to_info_[var]->type; auto* type = variable_to_info_[var]->type;
if (auto* r = type->UnwrapAll()->As<type::Array>()) { if (auto* r = type->UnwrapAll()->As<type::ArrayType>()) {
if (r->IsRuntimeArray()) { if (r->IsRuntimeArray()) {
diagnostics_.add_error( diagnostics_.add_error(
"v-0015", "v-0015",
@ -568,7 +568,7 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func) {
builder_->Symbols().NameFor(func->symbol()), builder_->Symbols().NameFor(func->symbol()),
func->source()); func->source());
return false; return false;
} else if (auto* arr = member_ty->As<type::Array>()) { } else if (auto* arr = member_ty->As<type::ArrayType>()) {
if (arr->IsRuntimeArray()) { if (arr->IsRuntimeArray()) {
diagnostics_.add_error( diagnostics_.add_error(
"entry point IO types cannot contain runtime sized arrays", "entry point IO types cannot contain runtime sized arrays",
@ -946,7 +946,7 @@ bool Resolver::ArrayAccessor(ast::ArrayAccessorExpression* expr) {
auto* res = TypeOf(expr->array()); auto* res = TypeOf(expr->array());
auto* parent_type = res->UnwrapAll(); auto* parent_type = res->UnwrapAll();
type::Type* ret = nullptr; type::Type* ret = nullptr;
if (auto* arr = parent_type->As<type::Array>()) { if (auto* arr = parent_type->As<type::ArrayType>()) {
ret = arr->type(); ret = arr->type();
} else if (auto* vec = parent_type->As<type::Vector>()) { } else if (auto* vec = parent_type->As<type::Vector>()) {
ret = vec->type(); ret = vec->type();
@ -962,7 +962,7 @@ bool Resolver::ArrayAccessor(ast::ArrayAccessorExpression* expr) {
// If we're extracting from a pointer, we return a pointer. // If we're extracting from a pointer, we return a pointer.
if (auto* ptr = res->As<type::Pointer>()) { if (auto* ptr = res->As<type::Pointer>()) {
ret = builder_->create<type::Pointer>(ret, ptr->storage_class()); ret = builder_->create<type::Pointer>(ret, ptr->storage_class());
} else if (auto* arr = parent_type->As<type::Array>()) { } else if (auto* arr = parent_type->As<type::ArrayType>()) {
if (!arr->type()->is_scalar()) { if (!arr->type()->is_scalar()) {
// If we extract a non-scalar from an array then we also get a pointer. We // If we extract a non-scalar from an array then we also get a pointer. We
// will generate a Function storage class variable to store this into. // will generate a Function storage class variable to store this into.
@ -1916,9 +1916,9 @@ bool Resolver::DefaultAlignAndSize(type::Type* ty,
return true; return true;
} }
return false; return false;
} else if (cty->Is<type::Array>()) { } else if (cty->Is<type::ArrayType>()) {
if (auto* sem = if (auto* sem =
Array(ty->UnwrapAliasIfNeeded()->As<type::Array>(), source)) { Array(ty->UnwrapAliasIfNeeded()->As<type::ArrayType>(), source)) {
align = sem->Align(); align = sem->Align();
size = sem->Size(); size = sem->Size();
return true; return true;
@ -1929,7 +1929,7 @@ bool Resolver::DefaultAlignAndSize(type::Type* ty,
return false; return false;
} }
const sem::Array* Resolver::Array(type::Array* arr, const Source& source) { const sem::Array* Resolver::Array(type::ArrayType* arr, const Source& source) {
if (auto* sem = builder_->Sem().Get(arr)) { if (auto* sem = builder_->Sem().Get(arr)) {
// Semantic info already constructed for this array type // Semantic info already constructed for this array type
return sem; return sem;
@ -2000,7 +2000,7 @@ const sem::Array* Resolver::Array(type::Array* arr, const Source& source) {
bool Resolver::ValidateStructure(const type::Struct* st) { bool Resolver::ValidateStructure(const type::Struct* st) {
for (auto* member : st->impl()->members()) { for (auto* member : st->impl()->members()) {
if (auto* r = member->type()->UnwrapAll()->As<type::Array>()) { if (auto* r = member->type()->UnwrapAll()->As<type::ArrayType>()) {
if (r->IsRuntimeArray()) { if (r->IsRuntimeArray()) {
if (member != st->impl()->members().back()) { if (member != st->impl()->members().back()) {
diagnostics_.add_error( diagnostics_.add_error(
@ -2391,7 +2391,7 @@ bool Resolver::ApplyStorageClassUsageToType(ast::StorageClass sc,
return true; return true;
} }
if (auto* arr = ty->As<type::Array>()) { if (auto* arr = ty->As<type::ArrayType>()) {
return ApplyStorageClassUsageToType(sc, arr->type(), usage); return ApplyStorageClassUsageToType(sc, arr->type(), usage);
} }

View File

@ -256,7 +256,7 @@ class Resolver {
/// returned. /// returned.
/// @param arr the Array to get semantic information for /// @param arr the Array to get semantic information for
/// @param source the Source of the ast node with this array as its type /// @param source the Source of the ast node with this array as its type
const sem::Array* Array(type::Array* arr, const Source& source); const sem::Array* Array(type::ArrayType* arr, const Source& source);
/// @returns the StructInfo for the structure `str`, building it if it hasn't /// @returns the StructInfo for the structure `str`, building it if it hasn't
/// been constructed already. If an error is raised, nullptr is returned. /// been constructed already. If an error is raised, nullptr is returned.

View File

@ -19,7 +19,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Array);
namespace tint { namespace tint {
namespace sem { namespace sem {
Array::Array(type::Array* type, uint32_t align, uint32_t size, uint32_t stride) Array::Array(type::ArrayType* type,
uint32_t align,
uint32_t size,
uint32_t stride)
: type_(type), align_(align), size_(size), stride_(stride) {} : type_(type), align_(align), size_(size), stride_(stride) {}
} // namespace sem } // namespace sem

View File

@ -23,7 +23,7 @@ namespace tint {
// Forward declarations // Forward declarations
namespace type { namespace type {
class Array; class ArrayType;
} // namespace type } // namespace type
namespace sem { namespace sem {
@ -37,10 +37,10 @@ class Array : public Castable<Array, Node> {
/// @param size the byte size of the structure /// @param size the byte size of the structure
/// @param stride the number of bytes from the start of one element of the /// @param stride the number of bytes from the start of one element of the
/// array to the start of the next element /// array to the start of the next element
Array(type::Array* type, uint32_t align, uint32_t size, uint32_t stride); Array(type::ArrayType* type, uint32_t align, uint32_t size, uint32_t stride);
/// @return the resolved type of the Array /// @return the resolved type of the Array
type::Array* Type() const { return type_; } type::ArrayType* Type() const { return type_; }
/// @returns the byte alignment of the array /// @returns the byte alignment of the array
/// @note this may differ from the alignment of a structure member of this /// @note this may differ from the alignment of a structure member of this
@ -57,7 +57,7 @@ class Array : public Castable<Array, Node> {
uint32_t Stride() const { return stride_; } uint32_t Stride() const { return stride_; }
private: private:
type::Array* const type_; type::ArrayType* const type_;
uint32_t const align_; uint32_t const align_;
uint32_t const size_; uint32_t const size_;
uint32_t const stride_; uint32_t const stride_;

View File

@ -30,7 +30,7 @@ class StructMember;
class Variable; class Variable;
} // namespace ast } // namespace ast
namespace type { namespace type {
class Array; class ArrayType;
class Struct; class Struct;
} // namespace type } // namespace type
@ -53,7 +53,7 @@ class Variable;
/// rules will be used to infer the return type based on the argument type. /// rules will be used to infer the return type based on the argument type.
struct TypeMappings { struct TypeMappings {
//! @cond Doxygen_Suppress //! @cond Doxygen_Suppress
Array* operator()(type::Array*); Array* operator()(type::ArrayType*);
Call* operator()(ast::CallExpression*); Call* operator()(ast::CallExpression*);
Expression* operator()(ast::Expression*); Expression* operator()(ast::Expression*);
Function* operator()(ast::Function*); Function* operator()(ast::Function*);

View File

@ -42,7 +42,7 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
auto& diags = ctx->dst->Diagnostics(); auto& diags = ctx->dst->Diagnostics();
auto* ret_type = ctx->src->Sem().Get(expr->array())->Type()->UnwrapAll(); auto* ret_type = ctx->src->Sem().Get(expr->array())->Type()->UnwrapAll();
if (!ret_type->Is<type::Array>() && !ret_type->Is<type::Matrix>() && if (!ret_type->Is<type::ArrayType>() && !ret_type->Is<type::Matrix>() &&
!ret_type->Is<type::Vector>()) { !ret_type->Is<type::Vector>()) {
return nullptr; return nullptr;
} }
@ -52,10 +52,10 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
uint32_t size = 0; uint32_t size = 0;
bool is_vec = ret_type->Is<type::Vector>(); bool is_vec = ret_type->Is<type::Vector>();
bool is_arr = ret_type->Is<type::Array>(); bool is_arr = ret_type->Is<type::ArrayType>();
if (is_vec || is_arr) { if (is_vec || is_arr) {
size = is_vec ? ret_type->As<type::Vector>()->size() size = is_vec ? ret_type->As<type::Vector>()->size()
: ret_type->As<type::Array>()->size(); : ret_type->As<type::ArrayType>()->size();
} else { } else {
// The row accessor would have been an embedded array accessor and already // The row accessor would have been an embedded array accessor and already
// handled, so we just need to do columns here. // handled, so we just need to do columns here.

View File

@ -447,7 +447,7 @@ struct State {
member->Declaration()->type()->UnwrapAll()); member->Declaration()->type()->UnwrapAll());
values.emplace_back(ctx.dst->Call(load, "buffer", offset)); values.emplace_back(ctx.dst->Call(load, "buffer", offset));
} }
} else if (auto* arr_ty = el_ty->As<type::Array>()) { } else if (auto* arr_ty = el_ty->As<type::ArrayType>()) {
auto& sem = ctx.src->Sem(); auto& sem = ctx.src->Sem();
auto* arr = sem.Get(arr_ty); auto* arr = sem.Get(arr_ty);
for (uint32_t i = 0; i < arr_ty->size(); i++) { for (uint32_t i = 0; i < arr_ty->size(); i++) {
@ -518,7 +518,7 @@ struct State {
auto* call = ctx.dst->Call(store, "buffer", offset, access); auto* call = ctx.dst->Call(store, "buffer", offset, access);
body.emplace_back(ctx.dst->create<ast::CallStatement>(call)); body.emplace_back(ctx.dst->create<ast::CallStatement>(call));
} }
} else if (auto* arr_ty = el_ty->As<type::Array>()) { } else if (auto* arr_ty = el_ty->As<type::ArrayType>()) {
auto& sem = ctx.src->Sem(); auto& sem = ctx.src->Sem();
auto* arr = sem.Get(arr_ty); auto* arr = sem.Get(arr_ty);
for (uint32_t i = 0; i < arr_ty->size(); i++) { for (uint32_t i = 0; i < arr_ty->size(); i++) {
@ -678,7 +678,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
if (auto* accessor = node->As<ast::ArrayAccessorExpression>()) { if (auto* accessor = node->As<ast::ArrayAccessorExpression>()) {
if (auto access = state.TakeAccess(accessor->array())) { if (auto access = state.TakeAccess(accessor->array())) {
// X[Y] // X[Y]
if (auto* arr_ty = access.type->As<type::Array>()) { if (auto* arr_ty = access.type->As<type::ArrayType>()) {
auto stride = sem.Get(arr_ty)->Stride(); auto stride = sem.Get(arr_ty)->Stride();
auto offset = Mul(stride, accessor->idx_expr()); auto offset = Mul(stride, accessor->idx_expr());
state.AddAccesss(accessor, state.AddAccesss(accessor,

View File

@ -96,7 +96,7 @@ void Hlsl::PromoteInitializersToConstVar(CloneContext& ctx) const {
} }
auto* src_ty = src_sem_expr->Type(); auto* src_ty = src_sem_expr->Type();
if (src_ty->IsAnyOf<type::Array, type::Struct>()) { if (src_ty->IsAnyOf<type::ArrayType, type::Struct>()) {
// Create a new symbol for the constant // Create a new symbol for the constant
auto dst_symbol = ctx.dst->Symbols().New(); auto dst_symbol = ctx.dst->Symbols().New();
// Clone the type // Clone the type

View File

@ -37,7 +37,7 @@ TEST_F(AccessControlTest, Is) {
Type* ty = &at; Type* ty = &at;
EXPECT_TRUE(ty->Is<AccessControl>()); EXPECT_TRUE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -33,7 +33,7 @@ TEST_F(AliasTest, Is) {
type::Type* ty = at; type::Type* ty = at;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_TRUE(ty->Is<Alias>()); EXPECT_TRUE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -18,19 +18,21 @@
#include "src/program_builder.h" #include "src/program_builder.h"
TINT_INSTANTIATE_TYPEINFO(tint::type::Array); TINT_INSTANTIATE_TYPEINFO(tint::type::ArrayType);
namespace tint { namespace tint {
namespace type { namespace type {
Array::Array(Type* subtype, uint32_t size, ast::DecorationList decorations) ArrayType::ArrayType(Type* subtype,
uint32_t size,
ast::DecorationList decorations)
: subtype_(subtype), size_(size), decos_(decorations) {} : subtype_(subtype), size_(size), decos_(decorations) {}
Array::Array(Array&&) = default; ArrayType::ArrayType(ArrayType&&) = default;
Array::~Array() = default; ArrayType::~ArrayType() = default;
std::string Array::type_name() const { std::string ArrayType::type_name() const {
TINT_ASSERT(subtype_); TINT_ASSERT(subtype_);
std::string type_name = "__array" + subtype_->type_name(); std::string type_name = "__array" + subtype_->type_name();
@ -46,7 +48,7 @@ std::string Array::type_name() const {
return type_name; return type_name;
} }
std::string Array::FriendlyName(const SymbolTable& symbols) const { std::string ArrayType::FriendlyName(const SymbolTable& symbols) const {
std::ostringstream out; std::ostringstream out;
for (auto* deco : decos_) { for (auto* deco : decos_) {
if (auto* stride = deco->As<ast::StrideDecoration>()) { if (auto* stride = deco->As<ast::StrideDecoration>()) {
@ -61,11 +63,11 @@ std::string Array::FriendlyName(const SymbolTable& symbols) const {
return out.str(); return out.str();
} }
Array* Array::Clone(CloneContext* ctx) const { ArrayType* ArrayType::Clone(CloneContext* ctx) const {
// Clone arguments outside of create() call to have deterministic ordering // Clone arguments outside of create() call to have deterministic ordering
auto* ty = ctx->Clone(type()); auto* ty = ctx->Clone(type());
auto decos = ctx->Clone(decorations()); auto decos = ctx->Clone(decorations());
return ctx->dst->create<Array>(ty, size_, decos); return ctx->dst->create<ArrayType>(ty, size_, decos);
} }
} // namespace type } // namespace type

View File

@ -24,17 +24,19 @@ namespace tint {
namespace type { namespace type {
/// An array type. If size is zero then it is a runtime array. /// An array type. If size is zero then it is a runtime array.
class Array : public Castable<Array, Type> { // TODO(amaiorano): https://crbug.com/tint/724 Fold into sem::Array once parsers
// don't create this anymore.
class ArrayType : public Castable<ArrayType, Type> {
public: public:
/// Constructor /// Constructor
/// @param subtype the type of the array elements /// @param subtype the type of the array elements
/// @param size the number of elements in the array. `0` represents a /// @param size the number of elements in the array. `0` represents a
/// runtime-sized array. /// runtime-sized array.
/// @param decorations the array decorations /// @param decorations the array decorations
Array(Type* subtype, uint32_t size, ast::DecorationList decorations); ArrayType(Type* subtype, uint32_t size, ast::DecorationList decorations);
/// Move constructor /// Move constructor
Array(Array&&); ArrayType(ArrayType&&);
~Array() override; ~ArrayType() override;
/// @returns true if this is a runtime array. /// @returns true if this is a runtime array.
/// i.e. the size is determined at runtime /// i.e. the size is determined at runtime
@ -59,7 +61,7 @@ class Array : public Castable<Array, Type> {
/// Clones this type and all transitive types using the `CloneContext` `ctx`. /// Clones this type and all transitive types using the `CloneContext` `ctx`.
/// @param ctx the clone context /// @param ctx the clone context
/// @return the newly cloned type /// @return the newly cloned type
Array* Clone(CloneContext* ctx) const override; ArrayType* Clone(CloneContext* ctx) const override;
private: private:
Type* const subtype_; Type* const subtype_;

View File

@ -24,30 +24,30 @@ using ArrayTest = TestHelper;
TEST_F(ArrayTest, CreateSizedArray) { TEST_F(ArrayTest, CreateSizedArray) {
U32 u32; U32 u32;
Array arr{&u32, 3, ast::DecorationList{}}; ArrayType arr{&u32, 3, ast::DecorationList{}};
EXPECT_EQ(arr.type(), &u32); EXPECT_EQ(arr.type(), &u32);
EXPECT_EQ(arr.size(), 3u); EXPECT_EQ(arr.size(), 3u);
EXPECT_TRUE(arr.Is<Array>()); EXPECT_TRUE(arr.Is<ArrayType>());
EXPECT_FALSE(arr.IsRuntimeArray()); EXPECT_FALSE(arr.IsRuntimeArray());
} }
TEST_F(ArrayTest, CreateRuntimeArray) { TEST_F(ArrayTest, CreateRuntimeArray) {
U32 u32; U32 u32;
Array arr{&u32, 0, ast::DecorationList{}}; ArrayType arr{&u32, 0, ast::DecorationList{}};
EXPECT_EQ(arr.type(), &u32); EXPECT_EQ(arr.type(), &u32);
EXPECT_EQ(arr.size(), 0u); EXPECT_EQ(arr.size(), 0u);
EXPECT_TRUE(arr.Is<Array>()); EXPECT_TRUE(arr.Is<ArrayType>());
EXPECT_TRUE(arr.IsRuntimeArray()); EXPECT_TRUE(arr.IsRuntimeArray());
} }
TEST_F(ArrayTest, Is) { TEST_F(ArrayTest, Is) {
I32 i32; I32 i32;
Array arr{&i32, 3, ast::DecorationList{}}; ArrayType arr{&i32, 3, ast::DecorationList{}};
Type* ty = &arr; Type* ty = &arr;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_TRUE(ty->Is<Array>()); EXPECT_TRUE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());
@ -62,35 +62,36 @@ TEST_F(ArrayTest, Is) {
TEST_F(ArrayTest, TypeName) { TEST_F(ArrayTest, TypeName) {
I32 i32; I32 i32;
Array arr{&i32, 0, ast::DecorationList{}}; ArrayType arr{&i32, 0, ast::DecorationList{}};
EXPECT_EQ(arr.type_name(), "__array__i32"); EXPECT_EQ(arr.type_name(), "__array__i32");
} }
TEST_F(ArrayTest, FriendlyNameRuntimeSized) { TEST_F(ArrayTest, FriendlyNameRuntimeSized) {
Array arr{ty.i32(), 0, ast::DecorationList{}}; ArrayType arr{ty.i32(), 0, ast::DecorationList{}};
EXPECT_EQ(arr.FriendlyName(Symbols()), "array<i32>"); EXPECT_EQ(arr.FriendlyName(Symbols()), "array<i32>");
} }
TEST_F(ArrayTest, FriendlyNameStaticSized) { TEST_F(ArrayTest, FriendlyNameStaticSized) {
Array arr{ty.i32(), 5, ast::DecorationList{}}; ArrayType arr{ty.i32(), 5, ast::DecorationList{}};
EXPECT_EQ(arr.FriendlyName(Symbols()), "array<i32, 5>"); EXPECT_EQ(arr.FriendlyName(Symbols()), "array<i32, 5>");
} }
TEST_F(ArrayTest, FriendlyNameWithStride) { TEST_F(ArrayTest, FriendlyNameWithStride) {
Array arr{ty.i32(), 5, ArrayType arr{ty.i32(), 5,
ast::DecorationList{create<ast::StrideDecoration>(32)}}; ast::DecorationList{create<ast::StrideDecoration>(32)}};
EXPECT_EQ(arr.FriendlyName(Symbols()), "[[stride(32)]] array<i32, 5>"); EXPECT_EQ(arr.FriendlyName(Symbols()), "[[stride(32)]] array<i32, 5>");
} }
TEST_F(ArrayTest, TypeName_RuntimeArray) { TEST_F(ArrayTest, TypeName_RuntimeArray) {
I32 i32; I32 i32;
Array arr{&i32, 3, ast::DecorationList{}}; ArrayType arr{&i32, 3, ast::DecorationList{}};
EXPECT_EQ(arr.type_name(), "__array__i32_3"); EXPECT_EQ(arr.type_name(), "__array__i32_3");
} }
TEST_F(ArrayTest, TypeName_WithStride) { TEST_F(ArrayTest, TypeName_WithStride) {
I32 i32; I32 i32;
Array arr{&i32, 3, ast::DecorationList{create<ast::StrideDecoration>(16)}}; ArrayType arr{&i32, 3,
ast::DecorationList{create<ast::StrideDecoration>(16)}};
EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16"); EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16");
} }

View File

@ -27,7 +27,7 @@ TEST_F(BoolTest, Is) {
Type* ty = &b; Type* ty = &b;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_TRUE(ty->Is<Bool>()); EXPECT_TRUE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -32,7 +32,7 @@ TEST_F(DepthTextureTest, Is) {
Type* ty = &d; Type* ty = &d;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -33,7 +33,7 @@ TEST_F(ExternalTextureTest, Is) {
Type* ty = &s; Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -27,7 +27,7 @@ TEST_F(F32Test, Is) {
Type* ty = &f; Type* ty = &f;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_TRUE(ty->Is<F32>()); EXPECT_TRUE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -27,7 +27,7 @@ TEST_F(I32Test, Is) {
Type* ty = &i; Type* ty = &i;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_TRUE(ty->Is<I32>()); EXPECT_TRUE(ty->Is<I32>());

View File

@ -36,7 +36,7 @@ TEST_F(MatrixTest, Is) {
Type* ty = &m; Type* ty = &m;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -33,7 +33,7 @@ TEST_F(MultisampledTextureTest, Is) {
Type* ty = &s; Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -35,7 +35,7 @@ TEST_F(PointerTest, Is) {
Type* ty = &p; Type* ty = &p;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -32,7 +32,7 @@ TEST_F(SampledTextureTest, Is) {
Type* ty = &s; Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -38,7 +38,7 @@ TEST_F(SamplerTest, Is) {
Type* ty = &s; Type* ty = &s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -34,7 +34,7 @@ TEST_F(StorageTextureTest, Is) {
Type* ty = s; Type* ty = s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -37,7 +37,7 @@ TEST_F(StructTypeTest, Is) {
type::Type* ty = s; type::Type* ty = s;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -27,7 +27,7 @@ TEST_F(U32Test, Is) {
Type* ty = &u; Type* ty = &u;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -35,7 +35,7 @@ TEST_F(VectorTest, Is) {
Type* ty = &v; Type* ty = &v;
EXPECT_FALSE(ty->Is<AccessControl>()); EXPECT_FALSE(ty->Is<AccessControl>());
EXPECT_FALSE(ty->Is<Alias>()); EXPECT_FALSE(ty->Is<Alias>());
EXPECT_FALSE(ty->Is<Array>()); EXPECT_FALSE(ty->Is<ArrayType>());
EXPECT_FALSE(ty->Is<Bool>()); EXPECT_FALSE(ty->Is<Bool>());
EXPECT_FALSE(ty->Is<F32>()); EXPECT_FALSE(ty->Is<F32>());
EXPECT_FALSE(ty->Is<I32>()); EXPECT_FALSE(ty->Is<I32>());

View File

@ -1315,8 +1315,9 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& pre,
return EmitZeroValue(out, expr->type()); return EmitZeroValue(out, expr->type());
} }
bool brackets = bool brackets = expr->type()
expr->type()->UnwrapAliasIfNeeded()->IsAnyOf<type::Array, type::Struct>(); ->UnwrapAliasIfNeeded()
->IsAnyOf<type::ArrayType, type::Struct>();
if (brackets) { if (brackets) {
out << "{"; out << "{";
@ -1643,7 +1644,7 @@ bool GeneratorImpl::EmitFunctionInternal(std::ostream& out,
return false; return false;
} }
// Array name is output as part of the type // Array name is output as part of the type
if (!type->Is<type::Array>()) { if (!type->Is<type::ArrayType>()) {
out << " " << builder_.Symbols().NameFor(v->symbol()); out << " " << builder_.Symbols().NameFor(v->symbol());
} }
} }
@ -1909,7 +1910,7 @@ bool GeneratorImpl::EmitEntryPointData(
if (!EmitType(out, var->DeclaredType(), var->StorageClass(), name)) { if (!EmitType(out, var->DeclaredType(), var->StorageClass(), name)) {
return false; return false;
} }
if (!var->DeclaredType()->UnwrapAliasIfNeeded()->Is<type::Array>()) { if (!var->DeclaredType()->UnwrapAliasIfNeeded()->Is<type::ArrayType>()) {
out << " " << name; out << " " << name;
} }
@ -2397,10 +2398,10 @@ bool GeneratorImpl::EmitType(std::ostream& out,
if (auto* alias = type->As<type::Alias>()) { if (auto* alias = type->As<type::Alias>()) {
out << builder_.Symbols().NameFor(alias->symbol()); out << builder_.Symbols().NameFor(alias->symbol());
} else if (auto* ary = type->As<type::Array>()) { } else if (auto* ary = type->As<type::ArrayType>()) {
type::Type* base_type = ary; type::Type* base_type = ary;
std::vector<uint32_t> sizes; std::vector<uint32_t> sizes;
while (auto* arr = base_type->As<type::Array>()) { while (auto* arr = base_type->As<type::ArrayType>()) {
if (arr->IsRuntimeArray()) { if (arr->IsRuntimeArray()) {
TINT_ICE(diagnostics_) TINT_ICE(diagnostics_)
<< "Runtime arrays may only exist in storage buffers, which should " << "Runtime arrays may only exist in storage buffers, which should "
@ -2564,7 +2565,7 @@ bool GeneratorImpl::EmitStructType(std::ostream& out,
return false; return false;
} }
// Array member name will be output with the type // Array member name will be output with the type
if (!mem->type()->Is<type::Array>()) { if (!mem->type()->Is<type::ArrayType>()) {
out << " " << builder_.Symbols().NameFor(mem->symbol()); out << " " << builder_.Symbols().NameFor(mem->symbol());
} }
@ -2663,7 +2664,7 @@ bool GeneratorImpl::EmitVariable(std::ostream& out,
builder_.Symbols().NameFor(var->symbol()))) { builder_.Symbols().NameFor(var->symbol()))) {
return false; return false;
} }
if (!type->Is<type::Array>()) { if (!type->Is<type::ArrayType>()) {
out << " " << builder_.Symbols().NameFor(var->symbol()); out << " " << builder_.Symbols().NameFor(var->symbol());
} }
out << constructor_out.str() << ";" << std::endl; out << constructor_out.str() << ";" << std::endl;
@ -2725,7 +2726,7 @@ bool GeneratorImpl::EmitProgramConstVariable(std::ostream& out,
builder_.Symbols().NameFor(var->symbol()))) { builder_.Symbols().NameFor(var->symbol()))) {
return false; return false;
} }
if (!type->Is<type::Array>()) { if (!type->Is<type::ArrayType>()) {
out << " " << builder_.Symbols().NameFor(var->symbol()); out << " " << builder_.Symbols().NameFor(var->symbol());
} }

View File

@ -886,7 +886,7 @@ bool GeneratorImpl::EmitContinue(ast::ContinueStatement*) {
} }
bool GeneratorImpl::EmitTypeConstructor(ast::TypeConstructorExpression* expr) { bool GeneratorImpl::EmitTypeConstructor(ast::TypeConstructorExpression* expr) {
if (expr->type()->IsAnyOf<type::Array, type::Struct>()) { if (expr->type()->IsAnyOf<type::ArrayType, type::Struct>()) {
out_ << "{"; out_ << "{";
} else { } else {
if (!EmitType(expr->type(), "")) { if (!EmitType(expr->type(), "")) {
@ -915,7 +915,7 @@ bool GeneratorImpl::EmitTypeConstructor(ast::TypeConstructorExpression* expr) {
} }
} }
if (expr->type()->IsAnyOf<type::Array, type::Struct>()) { if (expr->type()->IsAnyOf<type::ArrayType, type::Struct>()) {
out_ << "}"; out_ << "}";
} else { } else {
out_ << ")"; out_ << ")";
@ -936,7 +936,7 @@ bool GeneratorImpl::EmitZeroValue(type::Type* type) {
return EmitZeroValue(vec->type()); return EmitZeroValue(vec->type());
} else if (auto* mat = type->As<type::Matrix>()) { } else if (auto* mat = type->As<type::Matrix>()) {
return EmitZeroValue(mat->type()); return EmitZeroValue(mat->type());
} else if (auto* arr = type->As<type::Array>()) { } else if (auto* arr = type->As<type::ArrayType>()) {
out_ << "{"; out_ << "{";
if (!EmitZeroValue(arr->type())) { if (!EmitZeroValue(arr->type())) {
return false; return false;
@ -1325,7 +1325,7 @@ bool GeneratorImpl::EmitFunctionInternal(ast::Function* func,
return false; return false;
} }
// Array name is output as part of the type // Array name is output as part of the type
if (!type->Is<type::Array>()) { if (!type->Is<type::ArrayType>()) {
out_ << " " << program_->Symbols().NameFor(v->symbol()); out_ << " " << program_->Symbols().NameFor(v->symbol());
} }
} }
@ -1908,10 +1908,10 @@ bool GeneratorImpl::EmitType(type::Type* type, const std::string& name) {
if (auto* alias = type->As<type::Alias>()) { if (auto* alias = type->As<type::Alias>()) {
out_ << program_->Symbols().NameFor(alias->symbol()); out_ << program_->Symbols().NameFor(alias->symbol());
} else if (auto* ary = type->As<type::Array>()) { } else if (auto* ary = type->As<type::ArrayType>()) {
type::Type* base_type = ary; type::Type* base_type = ary;
std::vector<uint32_t> sizes; std::vector<uint32_t> sizes;
while (auto* arr = base_type->As<type::Array>()) { while (auto* arr = base_type->As<type::ArrayType>()) {
if (arr->IsRuntimeArray()) { if (arr->IsRuntimeArray()) {
sizes.push_back(1); sizes.push_back(1);
} else { } else {
@ -2120,7 +2120,7 @@ bool GeneratorImpl::EmitStructType(const type::Struct* str) {
auto* ty = mem->type()->UnwrapAliasIfNeeded(); auto* ty = mem->type()->UnwrapAliasIfNeeded();
// Array member name will be output with the type // Array member name will be output with the type
if (!ty->Is<type::Array>()) { if (!ty->Is<type::ArrayType>()) {
out_ << " " << program_->Symbols().NameFor(mem->symbol()); out_ << " " << program_->Symbols().NameFor(mem->symbol());
} }
@ -2222,7 +2222,7 @@ bool GeneratorImpl::EmitVariable(const sem::Variable* var,
if (!EmitType(var->Type(), program_->Symbols().NameFor(decl->symbol()))) { if (!EmitType(var->Type(), program_->Symbols().NameFor(decl->symbol()))) {
return false; return false;
} }
if (!var->Type()->Is<type::Array>()) { if (!var->Type()->Is<type::ArrayType>()) {
out_ << " " << program_->Symbols().NameFor(decl->symbol()); out_ << " " << program_->Symbols().NameFor(decl->symbol());
} }
@ -2265,7 +2265,7 @@ bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) {
if (!EmitType(type, program_->Symbols().NameFor(var->symbol()))) { if (!EmitType(type, program_->Symbols().NameFor(var->symbol()))) {
return false; return false;
} }
if (!type->Is<type::Array>()) { if (!type->Is<type::ArrayType>()) {
out_ << " " << program_->Symbols().NameFor(var->symbol()); out_ << " " << program_->Symbols().NameFor(var->symbol());
} }
@ -2326,7 +2326,7 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(
} }
} }
if (auto* arr = ty->As<type::Array>()) { if (auto* arr = ty->As<type::ArrayType>()) {
auto* sem = program_->Sem().Get(arr); auto* sem = program_->Sem().Get(arr);
if (!sem) { if (!sem) {
TINT_ICE(diagnostics_) << "Array missing semantic info"; TINT_ICE(diagnostics_) << "Array missing semantic info";

View File

@ -52,7 +52,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const) {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) {
type::Array ary(ty.f32(), 5, ast::DecorationList{}); type::ArrayType ary(ty.f32(), 5, ast::DecorationList{});
auto* var = Var("a", &ary, ast::StorageClass::kNone); auto* var = Var("a", &ary, ast::StorageClass::kNone);
auto* stmt = create<ast::VariableDeclStatement>(var); auto* stmt = create<ast::VariableDeclStatement>(var);

View File

@ -112,7 +112,7 @@ uint32_t IndexFromName(char name) {
/// @param type the given type, which must not be null /// @param type the given type, which must not be null
/// @returns the nested matrix type, or nullptr if none /// @returns the nested matrix type, or nullptr if none
type::Matrix* GetNestedMatrixType(type::Type* type) { type::Matrix* GetNestedMatrixType(type::Type* type) {
while (auto* arr = type->As<type::Array>()) { while (auto* arr = type->As<type::ArrayType>()) {
type = arr->type(); type = arr->type();
} }
return type->As<type::Matrix>(); return type->As<type::Matrix>();
@ -827,8 +827,8 @@ bool Builder::GenerateArrayAccessor(ast::ArrayAccessorExpression* expr,
// If the source is a pointer we access chain into it. We also access chain // If the source is a pointer we access chain into it. We also access chain
// into an array of non-scalar types. // into an array of non-scalar types.
if (info->source_type->Is<type::Pointer>() || if (info->source_type->Is<type::Pointer>() ||
(info->source_type->Is<type::Array>() && (info->source_type->Is<type::ArrayType>() &&
!info->source_type->As<type::Array>()->type()->is_scalar())) { !info->source_type->As<type::ArrayType>()->type()->is_scalar())) {
info->access_chain_indices.push_back(idx_id); info->access_chain_indices.push_back(idx_id);
info->source_type = TypeOf(expr); info->source_type = TypeOf(expr);
return true; return true;
@ -1045,8 +1045,8 @@ uint32_t Builder::GenerateAccessorExpression(ast::Expression* expr) {
auto* ary_res_type = TypeOf(array->array()); auto* ary_res_type = TypeOf(array->array());
if (!ary_res_type->Is<type::Pointer>() && if (!ary_res_type->Is<type::Pointer>() &&
(ary_res_type->Is<type::Array>() && (ary_res_type->Is<type::ArrayType>() &&
!ary_res_type->As<type::Array>()->type()->is_scalar())) { !ary_res_type->As<type::ArrayType>()->type()->is_scalar())) {
type::Pointer ptr(ary_res_type, ast::StorageClass::kFunction); type::Pointer ptr(ary_res_type, ast::StorageClass::kFunction);
auto result_type_id = GenerateTypeIfNeeded(&ptr); auto result_type_id = GenerateTypeIfNeeded(&ptr);
if (result_type_id == 0) { if (result_type_id == 0) {
@ -1250,7 +1250,7 @@ bool Builder::is_constructor_const(ast::Expression* expr, bool is_global_init) {
subtype = vec->type()->UnwrapAll(); subtype = vec->type()->UnwrapAll();
} else if (auto* mat = subtype->As<type::Matrix>()) { } else if (auto* mat = subtype->As<type::Matrix>()) {
subtype = mat->type()->UnwrapAll(); subtype = mat->type()->UnwrapAll();
} else if (auto* arr = subtype->As<type::Array>()) { } else if (auto* arr = subtype->As<type::ArrayType>()) {
subtype = arr->type()->UnwrapAll(); subtype = arr->type()->UnwrapAll();
} else if (auto* str = subtype->As<type::Struct>()) { } else if (auto* str = subtype->As<type::Struct>()) {
subtype = str->impl()->members()[i]->type()->UnwrapAll(); subtype = str->impl()->members()[i]->type()->UnwrapAll();
@ -1329,7 +1329,7 @@ uint32_t Builder::GenerateTypeConstructorExpression(
// If the result is not a vector then we should have validated that the // If the result is not a vector then we should have validated that the
// value type is a correctly sized vector so we can just use it directly. // value type is a correctly sized vector so we can just use it directly.
if (result_type == value_type || result_type->Is<type::Matrix>() || if (result_type == value_type || result_type->Is<type::Matrix>() ||
result_type->Is<type::Array>() || result_type->Is<type::Struct>()) { result_type->Is<type::ArrayType>() || result_type->Is<type::Struct>()) {
out << "_" << id; out << "_" << id;
ops.push_back(Operand::Int(id)); ops.push_back(Operand::Int(id));
@ -2953,7 +2953,7 @@ uint32_t Builder::GenerateTypeIfNeeded(type::Type* type) {
result)) { result)) {
return 0; return 0;
} }
} else if (auto* arr = type->As<type::Array>()) { } else if (auto* arr = type->As<type::ArrayType>()) {
if (!GenerateArrayType(arr, result)) { if (!GenerateArrayType(arr, result)) {
return 0; return 0;
} }
@ -3084,7 +3084,7 @@ bool Builder::GenerateTextureType(type::Texture* texture,
return true; return true;
} }
bool Builder::GenerateArrayType(type::Array* ary, const Operand& result) { bool Builder::GenerateArrayType(type::ArrayType* ary, const Operand& result) {
auto elem_type = GenerateTypeIfNeeded(ary->type()); auto elem_type = GenerateTypeIfNeeded(ary->type());
if (elem_type == 0) { if (elem_type == 0) {
return false; return false;

View File

@ -433,7 +433,7 @@ class Builder {
/// @param ary the array to generate /// @param ary the array to generate
/// @param result the result operand /// @param result the result operand
/// @returns true if the array was successfully generated /// @returns true if the array was successfully generated
bool GenerateArrayType(type::Array* ary, const Operand& result); bool GenerateArrayType(type::ArrayType* ary, const Operand& result);
/// Generates a matrix type declaration /// Generates a matrix type declaration
/// @param mat the matrix to generate /// @param mat the matrix to generate
/// @param result the result operand /// @param result the result operand

View File

@ -390,7 +390,7 @@ bool GeneratorImpl::EmitType(type::Type* type) {
return true; return true;
} else if (auto* alias = type->As<type::Alias>()) { } else if (auto* alias = type->As<type::Alias>()) {
out_ << program_->Symbols().NameFor(alias->symbol()); out_ << program_->Symbols().NameFor(alias->symbol());
} else if (auto* ary = type->As<type::Array>()) { } else if (auto* ary = type->As<type::ArrayType>()) {
for (auto* deco : ary->decorations()) { for (auto* deco : ary->decorations()) {
if (auto* stride = deco->As<ast::StrideDecoration>()) { if (auto* stride = deco->As<ast::StrideDecoration>()) {
out_ << "[[stride(" << stride->stride() << ")]] "; out_ << "[[stride(" << stride->stride() << ")]] ";

View File

@ -73,10 +73,10 @@ TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_ReadWrite) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) { TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) {
auto* a = create<type::Array>(ty.bool_(), 4, auto* a = create<type::ArrayType>(ty.bool_(), 4,
ast::DecorationList{ ast::DecorationList{
create<ast::StrideDecoration>(16u), create<ast::StrideDecoration>(16u),
}); });
AST().AddConstructedType(ty.alias("make_type_reachable", a)); AST().AddConstructedType(ty.alias("make_type_reachable", a));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
@ -86,11 +86,11 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) { TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) {
auto* a = create<type::Array>(ty.bool_(), 4, auto* a = create<type::ArrayType>(ty.bool_(), 4,
ast::DecorationList{ ast::DecorationList{
create<ast::StrideDecoration>(16u), create<ast::StrideDecoration>(16u),
create<ast::StrideDecoration>(32u), create<ast::StrideDecoration>(32u),
}); });
AST().AddConstructedType(ty.alias("make_type_reachable", a)); AST().AddConstructedType(ty.alias("make_type_reachable", a));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
@ -100,7 +100,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_RuntimeArray) { TEST_F(WgslGeneratorImplTest, EmitType_RuntimeArray) {
auto* a = create<type::Array>(ty.bool_(), 0, ast::DecorationList{}); auto* a = create<type::ArrayType>(ty.bool_(), 0, ast::DecorationList{});
AST().AddConstructedType(ty.alias("make_type_reachable", a)); AST().AddConstructedType(ty.alias("make_type_reachable", a));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();