From 950809f534a598d7d2e3fd4ab0c67ece409e2edf Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 9 Jun 2021 14:32:14 +0000 Subject: [PATCH] Rename 'constructed types' to 'type declarartions' Change-Id: I0c79be17a10a542df602447e555c1344621d2dce Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53803 Kokoro: Kokoro Reviewed-by: Antonio Maiorano --- src/ast/module.cc | 12 +++--- src/ast/module.h | 14 +++---- src/ast/module_test.cc | 4 +- src/program_builder.h | 16 ++++---- src/program_test.cc | 4 +- src/reader/spirv/function.cc | 2 +- src/reader/spirv/parser_impl.cc | 10 ++--- src/reader/spirv/parser_impl.h | 8 ++-- src/reader/wgsl/parser_impl.cc | 27 +++++++------- src/reader/wgsl/parser_impl.h | 17 ++++----- .../wgsl/parser_impl_const_expr_test.cc | 2 +- src/reader/wgsl/parser_impl_error_msg_test.cc | 4 +- .../wgsl/parser_impl_function_header_test.cc | 2 +- .../parser_impl_global_constant_decl_test.cc | 2 +- .../wgsl/parser_impl_global_decl_test.cc | 37 +++++++++---------- .../parser_impl_primary_expression_test.cc | 2 +- .../wgsl/parser_impl_struct_decl_test.cc | 2 +- .../wgsl/parser_impl_struct_member_test.cc | 2 +- src/reader/wgsl/parser_impl_test.cc | 6 +-- .../parser_impl_texture_sampler_types_test.cc | 4 +- .../wgsl/parser_impl_type_alias_test.cc | 4 +- src/reader/wgsl/parser_impl_type_decl_test.cc | 12 +++--- .../parser_impl_variable_ident_decl_test.cc | 12 +++--- .../wgsl/parser_impl_variable_stmt_test.cc | 4 +- src/resolver/resolver_test_helper.h | 2 +- src/transform/canonicalize_entry_point_io.cc | 2 +- src/transform/decompose_storage_access.cc | 10 ++--- src/transform/single_entry_point.cc | 2 +- src/transform/spirv.cc | 2 +- src/writer/hlsl/generator_impl.cc | 12 +++--- src/writer/hlsl/generator_impl.h | 8 ++-- src/writer/msl/generator_impl.cc | 10 ++--- src/writer/msl/generator_impl.h | 8 ++-- src/writer/wgsl/generator_impl.cc | 6 +-- src/writer/wgsl/generator_impl.h | 8 ++-- .../wgsl/generator_impl_alias_type_test.cc | 10 ++--- 36 files changed, 141 insertions(+), 148 deletions(-) diff --git a/src/ast/module.cc b/src/ast/module.cc index fcb7216556..e85c033224 100644 --- a/src/ast/module.cc +++ b/src/ast/module.cc @@ -37,7 +37,7 @@ Module::Module(ProgramID program_id, } if (auto* ty = decl->As()) { - constructed_types_.push_back(ty); + type_decls_.push_back(ty); } else if (auto* func = decl->As()) { functions_.push_back(func); } else if (auto* var = decl->As()) { @@ -52,7 +52,7 @@ Module::Module(ProgramID program_id, Module::~Module() = default; const ast::TypeDecl* Module::LookupType(Symbol name) const { - for (auto* ty : ConstructedTypes()) { + for (auto* ty : TypeDecls()) { if (ty->name() == name) { return ty; } @@ -67,9 +67,9 @@ void Module::AddGlobalVariable(ast::Variable* var) { global_declarations_.push_back(var); } -void Module::AddConstructedType(ast::TypeDecl* type) { +void Module::AddTypeDecl(ast::TypeDecl* type) { TINT_ASSERT(type); - constructed_types_.push_back(type); + type_decls_.push_back(type); global_declarations_.push_back(type); } @@ -93,7 +93,7 @@ void Module::Copy(CloneContext* ctx, const Module* src) { continue; } if (auto* ty = decl->As()) { - AddConstructedType(ty); + AddTypeDecl(ty); } else if (auto* func = decl->As()) { AddFunction(func); } else if (auto* var = decl->As()) { @@ -110,7 +110,7 @@ void Module::to_str(const sem::Info& sem, make_indent(out, indent); out << "Module{" << std::endl; indent += 2; - for (auto* ty : constructed_types_) { + for (auto* ty : type_decls_) { make_indent(out, indent); if (auto* alias = ty->As()) { out << alias->symbol().to_str() << " -> " << alias->type()->type_name() diff --git a/src/ast/module.h b/src/ast/module.h index af502cfd0b..8ce8e7e89c 100644 --- a/src/ast/module.h +++ b/src/ast/module.h @@ -74,17 +74,15 @@ class Module : public Castable { VariableList& GlobalVariables() { return global_variables_; } /// Adds a type declaration to the Builder. - /// @param decl the constructed type declaration to add - void AddConstructedType(ast::TypeDecl* decl); + /// @param decl the type declaration to add + void AddTypeDecl(ast::TypeDecl* decl); - /// @returns the TypeDecl registered as a ConstructedType() + /// @returns the TypeDecl registered as a TypeDecl() /// @param name the name of the type to search for const ast::TypeDecl* LookupType(Symbol name) const; - /// @returns the constructed types in the translation unit - const std::vector& ConstructedTypes() const { - return constructed_types_; - } + /// @returns the declared types in the translation unit + const std::vector& TypeDecls() const { return type_decls_; } /// Add a function to the Builder /// @param func the function to add @@ -118,7 +116,7 @@ class Module : public Castable { private: std::vector global_declarations_; - std::vector constructed_types_; + std::vector type_decls_; FunctionList functions_; VariableList global_variables_; }; diff --git a/src/ast/module_test.cc b/src/ast/module_test.cc index 7007b4bb6b..28bf5487f1 100644 --- a/src/ast/module_test.cc +++ b/src/ast/module_test.cc @@ -55,11 +55,11 @@ TEST_F(ModuleTest, Assert_Null_GlobalVariable) { "internal compiler error"); } -TEST_F(ModuleTest, Assert_Null_ConstructedType) { +TEST_F(ModuleTest, Assert_Null_TypeDecl) { EXPECT_FATAL_FAILURE( { ProgramBuilder builder; - builder.AST().AddConstructedType(nullptr); + builder.AST().AddTypeDecl(nullptr); }, "internal compiler error"); } diff --git a/src/program_builder.h b/src/program_builder.h index 62c4ee80fa..5769545893 100644 --- a/src/program_builder.h +++ b/src/program_builder.h @@ -1598,7 +1598,7 @@ class ProgramBuilder { return create(Expr(std::forward(val))); } - /// Creates a ast::Alias registering it with the AST().ConstructedTypes(). + /// Creates a ast::Alias registering it with the AST().TypeDecls(). /// @param source the source information /// @param name the alias name /// @param type the alias target type @@ -1606,22 +1606,22 @@ class ProgramBuilder { template ast::Alias* Alias(const Source& source, NAME&& name, ast::Type* type) { auto* out = ty.alias(source, std::forward(name), type); - AST().AddConstructedType(out); + AST().AddTypeDecl(out); return out; } - /// Creates a ast::Alias registering it with the AST().ConstructedTypes(). + /// Creates a ast::Alias registering it with the AST().TypeDecls(). /// @param name the alias name /// @param type the alias target type /// @returns the alias type template ast::Alias* Alias(NAME&& name, ast::Type* type) { auto* out = ty.alias(std::forward(name), type); - AST().AddConstructedType(out); + AST().AddTypeDecl(out); return out; } - /// Creates a ast::Struct registering it with the AST().ConstructedTypes(). + /// Creates a ast::Struct registering it with the AST().TypeDecls(). /// @param source the source information /// @param name the struct name /// @param members the struct members @@ -1635,11 +1635,11 @@ class ProgramBuilder { auto sym = Sym(std::forward(name)); auto* type = create(source, sym, std::move(members), std::move(decorations)); - AST().AddConstructedType(type); + AST().AddTypeDecl(type); return type; } - /// Creates a ast::Struct registering it with the AST().ConstructedTypes(). + /// Creates a ast::Struct registering it with the AST().TypeDecls(). /// @param name the struct name /// @param members the struct members /// @param decorations the optional struct decorations @@ -1651,7 +1651,7 @@ class ProgramBuilder { auto sym = Sym(std::forward(name)); auto* type = create(sym, std::move(members), std::move(decorations)); - AST().AddConstructedType(type); + AST().AddTypeDecl(type); return type; } diff --git a/src/program_test.cc b/src/program_test.cc index 9b3e38e773..acd6355c87 100644 --- a/src/program_test.cc +++ b/src/program_test.cc @@ -68,11 +68,11 @@ TEST_F(ProgramTest, Assert_NullGlobalVariable) { "internal compiler error"); } -TEST_F(ProgramTest, Assert_NullConstructedType) { +TEST_F(ProgramTest, Assert_NullTypeDecl) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.AST().AddConstructedType(nullptr); + b.AST().AddTypeDecl(nullptr); }, "internal compiler error"); } diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 132f91f8e9..e5a97f06f7 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -1044,7 +1044,7 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { // Create and register the result type. auto* str = create(Source{}, return_struct_sym, return_members, ast::DecorationList{}); - parser_impl_.AddConstructedType(return_struct_sym, str); + parser_impl_.AddTypeDecl(return_struct_sym, str); return_type = builder_.ty.Of(str); // Add the return-value statement. diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index f262de955e..7551a7a558 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc @@ -1033,14 +1033,14 @@ const Type* ParserImpl::ConvertType( if (num_non_writable_members == members.size()) { read_only_struct_types_.insert(ast_struct->name()); } - AddConstructedType(sym, ast_struct); + AddTypeDecl(sym, ast_struct); return ty_.Struct(sym, std::move(ast_member_types)); } -void ParserImpl::AddConstructedType(Symbol name, ast::TypeDecl* decl) { - auto iter = constructed_types_.insert(name); +void ParserImpl::AddTypeDecl(Symbol name, ast::TypeDecl* decl) { + auto iter = declared_types_.insert(name); if (iter.second) { - builder_.AST().AddConstructedType(decl); + builder_.AST().AddTypeDecl(decl); } } @@ -1220,7 +1220,7 @@ const Type* ParserImpl::MaybeGenerateAlias( builder_.ty.alias(sym, ast_underlying_type->Build(builder_)); // Record this new alias as the AST type for this SPIR-V ID. - AddConstructedType(sym, ast_alias_type); + AddTypeDecl(sym, ast_alias_type); return ty_.Alias(sym, ast_underlying_type); } diff --git a/src/reader/spirv/parser_impl.h b/src/reader/spirv/parser_impl.h index d6d2ccfd65..062cb58c87 100644 --- a/src/reader/spirv/parser_impl.h +++ b/src/reader/spirv/parser_impl.h @@ -190,10 +190,10 @@ class ParserImpl : Reader { const spvtools::opt::analysis::Type* type, const Type* ast_type); - /// Adds `type` as a constructed type if it hasn't been added yet. + /// Adds `decl` as a declared type if it hasn't been added yet. /// @param name the type's unique name /// @param decl the type declaration to add - void AddConstructedType(Symbol name, ast::TypeDecl* decl); + void AddTypeDecl(Symbol name, ast::TypeDecl* decl); /// @returns the fail stream object FailStream& fail_stream() { return fail_stream_; } @@ -760,9 +760,9 @@ class ParserImpl : Reader { std::unordered_map handle_type_; - // Set of symbols of constructed types that have been added, used to avoid + // Set of symbols of declared type that have been added, used to avoid // adding duplicates. - std::unordered_set constructed_types_; + std::unordered_set declared_types_; /// Maps the SPIR-V ID of a module-scope builtin variable that should be /// ignored or type-converted, to its builtin kind. diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index aa52558e91..a84e15c8ac 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -312,16 +312,16 @@ Token ParserImpl::last_token() const { return last_token_; } -void ParserImpl::register_constructed(const std::string& name, - const ast::TypeDecl* type_decl) { - registered_constructs_[name] = type_decl; +void ParserImpl::register_type(const std::string& name, + const ast::TypeDecl* type_decl) { + registered_types_[name] = type_decl; } -const ast::TypeDecl* ParserImpl::get_constructed(const std::string& name) { - if (registered_constructs_.find(name) == registered_constructs_.end()) { +const ast::TypeDecl* ParserImpl::get_type(const std::string& name) { + if (registered_types_.find(name) == registered_types_.end()) { return nullptr; } - return registered_constructs_[name]; + return registered_types_[name]; } bool ParserImpl::Parse() { @@ -397,7 +397,7 @@ Expect ParserImpl::expect_global_decl() { if (!expect("type alias", Token::Type::kSemicolon)) return Failure::kErrored; - builder_.AST().AddConstructedType(const_cast(ta.value)); + builder_.AST().AddTypeDecl(const_cast(ta.value)); return true; } @@ -409,9 +409,8 @@ Expect ParserImpl::expect_global_decl() { if (!expect("struct declaration", Token::Type::kSemicolon)) return Failure::kErrored; - register_constructed(builder_.Symbols().NameFor(str.value->name()), - str.value); - builder_.AST().AddConstructedType(str.value); + register_type(builder_.Symbols().NameFor(str.value->name()), str.value); + builder_.AST().AddTypeDecl(str.value); return true; } @@ -1032,7 +1031,7 @@ Maybe ParserImpl::type_alias() { auto* alias = builder_.ty.alias(make_source_range_from(t.source()), name.value, type.value); - register_constructed(name.value, alias); + register_type(name.value, alias); return alias; } @@ -1082,9 +1081,9 @@ Maybe ParserImpl::type_decl(ast::DecorationList& decos) { Source source; if (match(Token::Type::kIdentifier, &source)) { // TODO(crbug.com/tint/697): Remove - auto* ty = get_constructed(t.to_str()); + auto* ty = get_type(t.to_str()); if (ty == nullptr) - return add_error(t, "unknown constructed type '" + t.to_str() + "'"); + return add_error(t, "unknown type '" + t.to_str() + "'"); return builder_.create( source, builder_.Symbols().Register(t.to_str())); @@ -2242,7 +2241,7 @@ Maybe ParserImpl::primary_expression() { return create(source, type.value, params.value); } - if (t.IsIdentifier() && !get_constructed(t.to_str())) { + if (t.IsIdentifier() && !get_type(t.to_str())) { next(); auto* ident = create( diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h index dce66628c2..8e6fb0cc8a 100644 --- a/src/reader/wgsl/parser_impl.h +++ b/src/reader/wgsl/parser_impl.h @@ -378,17 +378,16 @@ class ParserImpl { /// @param source the source to associate the error with /// @param msg the warning message void deprecated(const Source& source, const std::string& msg); - /// Registers a constructed type into the parser + /// Registers a declared type into the parser /// TODO(crbug.com/tint/724): Remove - /// @param name the constructed name - /// @param type_decl the constructed type declaration - void register_constructed(const std::string& name, - const ast::TypeDecl* type_decl); - /// Retrieves a constructed type + /// @param name the type name + /// @param type_decl the type declaration + void register_type(const std::string& name, const ast::TypeDecl* type_decl); + /// Retrieves a declared type /// TODO(crbug.com/tint/724): Remove /// @param name The name to lookup - /// @returns the constructed type for `name` or `nullptr` if not found - const ast::TypeDecl* get_constructed(const std::string& name); + /// @returns the declared type for `name` or `nullptr` if not found + const ast::TypeDecl* get_type(const std::string& name); /// Parses the `translation_unit` grammar element void translation_unit(); @@ -882,7 +881,7 @@ class ParserImpl { uint32_t sync_depth_ = 0; std::vector sync_tokens_; int silence_errors_ = 0; - std::unordered_map registered_constructs_; + std::unordered_map registered_types_; ProgramBuilder builder_; size_t max_errors_ = 25; }; diff --git a/src/reader/wgsl/parser_impl_const_expr_test.cc b/src/reader/wgsl/parser_impl_const_expr_test.cc index 6fc59bd00f..5a43c48341 100644 --- a/src/reader/wgsl/parser_impl_const_expr_test.cc +++ b/src/reader/wgsl/parser_impl_const_expr_test.cc @@ -134,7 +134,7 @@ TEST_F(ParserImplTest, ConstExpr_ConstLiteral_Invalid) { ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:1: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:1: unknown type 'invalid'"); } TEST_F(ParserImplTest, ConstExpr_Recursion) { diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc index 0de748091d..e1e8a978e1 100644 --- a/src/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/reader/wgsl/parser_impl_error_msg_test.cc @@ -420,7 +420,7 @@ TEST_F(ParserImplErrorTest, FunctionMissingOpenLine) { var a : f32 = bar[0]; return; })", - "test.wgsl:2:17 error: unknown constructed type 'bar'\n" + "test.wgsl:2:17 error: unknown type 'bar'\n" " var a : f32 = bar[0];\n" " ^^^\n" "\n" @@ -733,7 +733,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclTypeAliasMissingSemicolon) { TEST_F(ParserImplErrorTest, GlobalDeclTypeInvalid) { EXPECT("var x : fish;", - "test.wgsl:1:9 error: unknown constructed type 'fish'\n" + "test.wgsl:1:9 error: unknown type 'fish'\n" "var x : fish;\n" " ^^^^\n"); } diff --git a/src/reader/wgsl/parser_impl_function_header_test.cc b/src/reader/wgsl/parser_impl_function_header_test.cc index 193950ca1a..0cef4aaff9 100644 --- a/src/reader/wgsl/parser_impl_function_header_test.cc +++ b/src/reader/wgsl/parser_impl_function_header_test.cc @@ -112,7 +112,7 @@ TEST_F(ParserImplTest, FunctionHeader_InvalidReturnType) { EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:14: unknown type 'invalid'"); } TEST_F(ParserImplTest, FunctionHeader_MissingReturnType) { diff --git a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc index 8892df7b8b..bf48641265 100644 --- a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc @@ -85,7 +85,7 @@ TEST_F(ParserImplTest, GlobalConstantDecl_InvalidVariable) { EXPECT_TRUE(e.errored); EXPECT_FALSE(e.matched); EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:9: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:9: unknown type 'invalid'"); } TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) { diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc index d9421db4d5..ef7caff36a 100644 --- a/src/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_decl_test.cc @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Invalid) { auto p = parser("var a : vec2;"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:23: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:23: unknown type 'invalid'"); } TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_MissingSemicolon) { @@ -90,12 +90,11 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().ConstructedTypes().size(), 1u); - ASSERT_TRUE(program.AST().ConstructedTypes()[0]->Is()); - EXPECT_EQ( - program.Symbols().NameFor( - program.AST().ConstructedTypes()[0]->As()->symbol()), - "A"); + ASSERT_EQ(program.AST().TypeDecls().size(), 1u); + ASSERT_TRUE(program.AST().TypeDecls()[0]->Is()); + EXPECT_EQ(program.Symbols().NameFor( + program.AST().TypeDecls()[0]->As()->symbol()), + "A"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) { @@ -108,13 +107,13 @@ type B = A;)"); ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().ConstructedTypes().size(), 2u); - ASSERT_TRUE(program.AST().ConstructedTypes()[0]->Is()); - auto* str = program.AST().ConstructedTypes()[0]->As(); + ASSERT_EQ(program.AST().TypeDecls().size(), 2u); + ASSERT_TRUE(program.AST().TypeDecls()[0]->Is()); + auto* str = program.AST().TypeDecls()[0]->As(); EXPECT_EQ(str->name(), program.Symbols().Get("A")); - ASSERT_TRUE(program.AST().ConstructedTypes()[1]->Is()); - auto* alias = program.AST().ConstructedTypes()[1]->As(); + ASSERT_TRUE(program.AST().TypeDecls()[1]->Is()); + auto* alias = program.AST().TypeDecls()[1]->As(); EXPECT_EQ(alias->symbol(), program.Symbols().Get("B")); auto* tn = alias->type()->As(); EXPECT_NE(tn, nullptr); @@ -125,7 +124,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias_Invalid) { auto p = parser("type A = invalid;"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:10: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:10: unknown type 'invalid'"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_MissingSemicolon) { @@ -170,9 +169,9 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().ConstructedTypes().size(), 1u); + ASSERT_EQ(program.AST().TypeDecls().size(), 1u); - auto* t = program.AST().ConstructedTypes()[0]; + auto* t = program.AST().TypeDecls()[0]; ASSERT_NE(t, nullptr); ASSERT_TRUE(t->Is()); @@ -188,9 +187,9 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().ConstructedTypes().size(), 1u); + ASSERT_EQ(program.AST().TypeDecls().size(), 1u); - auto* t = program.AST().ConstructedTypes()[0]; + auto* t = program.AST().TypeDecls()[0]; ASSERT_NE(t, nullptr); ASSERT_TRUE(t->Is()); @@ -215,9 +214,9 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().ConstructedTypes().size(), 1u); + ASSERT_EQ(program.AST().TypeDecls().size(), 1u); - auto* t = program.AST().ConstructedTypes()[0]; + auto* t = program.AST().TypeDecls()[0]; ASSERT_NE(t, nullptr); ASSERT_TRUE(t->Is()); diff --git a/src/reader/wgsl/parser_impl_primary_expression_test.cc b/src/reader/wgsl/parser_impl_primary_expression_test.cc index 2c103974c0..28241a623a 100644 --- a/src/reader/wgsl/parser_impl_primary_expression_test.cc +++ b/src/reader/wgsl/parser_impl_primary_expression_test.cc @@ -300,7 +300,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_InvalidType) { EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:9: unknown type 'invalid'"); } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingLeftParen) { diff --git a/src/reader/wgsl/parser_impl_struct_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decl_test.cc index d98fb5c99b..1d5b78351b 100644 --- a/src/reader/wgsl/parser_impl_struct_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decl_test.cc @@ -152,7 +152,7 @@ TEST_F(ParserImplTest, StructDecl_InvalidStructBody) { EXPECT_EQ(s.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:16: unknown constructed type 'B'"); + EXPECT_EQ(p->error(), "1:16: unknown type 'B'"); } TEST_F(ParserImplTest, StructDecl_InvalidDecorationDecl) { diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc index eb81ae308c..cfa3555d2c 100644 --- a/src/reader/wgsl/parser_impl_struct_member_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_test.cc @@ -202,7 +202,7 @@ TEST_F(ParserImplTest, StructMember_InvalidVariable) { ASSERT_TRUE(p->has_error()); ASSERT_TRUE(m.errored); ASSERT_EQ(m.value, nullptr); - EXPECT_EQ(p->error(), "1:17: unknown constructed type 'B'"); + EXPECT_EQ(p->error(), "1:17: unknown type 'B'"); } TEST_F(ParserImplTest, StructMember_MissingSemicolon) { diff --git a/src/reader/wgsl/parser_impl_test.cc b/src/reader/wgsl/parser_impl_test.cc index 632d013f5a..42ee6cd497 100644 --- a/src/reader/wgsl/parser_impl_test.cc +++ b/src/reader/wgsl/parser_impl_test.cc @@ -54,15 +54,15 @@ fn main() -> { // missing return type TEST_F(ParserImplTest, GetRegisteredType) { auto p = parser(""); auto* alias = create(Sym("my_alias"), ty.i32()); - p->register_constructed("my_alias", alias); + p->register_type("my_alias", alias); - auto* got = p->get_constructed("my_alias"); + auto* got = p->get_type("my_alias"); EXPECT_EQ(got, alias); } TEST_F(ParserImplTest, GetUnregisteredType) { auto p = parser(""); - auto* alias = p->get_constructed("my_alias"); + auto* alias = p->get_type("my_alias"); ASSERT_EQ(alias, nullptr); } diff --git a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc index b36169aed1..fce5b3cf5c 100644 --- a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc +++ b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc @@ -126,7 +126,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid) { EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); - EXPECT_EQ(p->error(), "1:12: unknown constructed type 'abc'"); + EXPECT_EQ(p->error(), "1:12: unknown type 'abc'"); } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { @@ -185,7 +185,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_Invalid) { EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); - EXPECT_EQ(p->error(), "1:25: unknown constructed type 'abc'"); + EXPECT_EQ(p->error(), "1:25: unknown type 'abc'"); } TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { diff --git a/src/reader/wgsl/parser_impl_type_alias_test.cc b/src/reader/wgsl/parser_impl_type_alias_test.cc index fb2f2d31f6..274d8a9ca8 100644 --- a/src/reader/wgsl/parser_impl_type_alias_test.cc +++ b/src/reader/wgsl/parser_impl_type_alias_test.cc @@ -38,7 +38,7 @@ TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) { auto p = parser("type a = B"); auto* str = p->builder().Structure(p->builder().Symbols().Register("B"), {}); - p->register_constructed("B", str); + p->register_type("B", str); auto t = p->type_alias(); EXPECT_FALSE(p->has_error()); @@ -89,7 +89,7 @@ TEST_F(ParserImplTest, TypeDecl_InvalidType) { EXPECT_FALSE(t.matched); EXPECT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); - EXPECT_EQ(p->error(), "1:10: unknown constructed type 'B'"); + EXPECT_EQ(p->error(), "1:10: unknown type 'B'"); } } // namespace diff --git a/src/reader/wgsl/parser_impl_type_decl_test.cc b/src/reader/wgsl/parser_impl_type_decl_test.cc index fa44edf11e..3a2c2fc0de 100644 --- a/src/reader/wgsl/parser_impl_type_decl_test.cc +++ b/src/reader/wgsl/parser_impl_type_decl_test.cc @@ -38,7 +38,7 @@ TEST_F(ParserImplTest, TypeDecl_Identifier) { auto& builder = p->builder(); auto* alias_type = builder.ty.alias("A", builder.ty.i32()); - p->register_constructed("A", alias_type); + p->register_type("A", alias_type); auto t = p->type_decl(); EXPECT_TRUE(t.matched); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, TypeDecl_Identifier_NotFound) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:1: unknown constructed type 'B'"); + EXPECT_EQ(p->error(), "1:1: unknown type 'B'"); } TEST_F(ParserImplTest, TypeDecl_Bool) { @@ -182,7 +182,7 @@ TEST_P(VecBadType, Handles_Unknown_Type) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:6: unknown constructed type 'unknown'"); + ASSERT_EQ(p->error(), "1:6: unknown type 'unknown'"); } INSTANTIATE_TEST_SUITE_P(ParserImplTest, VecBadType, @@ -365,7 +365,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_BadType) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:15: unknown constructed type 'unknown'"); + ASSERT_EQ(p->error(), "1:15: unknown type 'unknown'"); } TEST_F(ParserImplTest, TypeDecl_Ptr_BadAccess) { @@ -599,7 +599,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_BadType) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:7: unknown constructed type 'unknown'"); + ASSERT_EQ(p->error(), "1:7: unknown type 'unknown'"); } TEST_F(ParserImplTest, TypeDecl_Array_ZeroSize) { @@ -761,7 +761,7 @@ TEST_P(MatrixBadType, Handles_Unknown_Type) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:8: unknown constructed type 'unknown'"); + ASSERT_EQ(p->error(), "1:8: unknown type 'unknown'"); } INSTANTIATE_TEST_SUITE_P( ParserImplTest, diff --git a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc index 541df21a4c..af959b4f54 100644 --- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc +++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) { auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:10: unknown constructed type 'invalid'"); + ASSERT_EQ(p->error(), "1:10: unknown type 'invalid'"); } // TODO(crbug.com/tint/846): Remove @@ -134,7 +134,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_Read_DEPRECATED) { auto* s = Structure(Sym("S"), members, decos); - p->register_constructed("S", s); + p->register_type("S", s); auto res = p->expect_global_decl(); ASSERT_FALSE(res.errored) << p->error(); @@ -166,7 +166,7 @@ TEST_F(ParserImplTest, auto* s = Structure(Sym("S"), members, decos); - p->register_constructed("S", s); + p->register_type("S", s); auto res = p->expect_global_decl(); ASSERT_FALSE(res.errored) << p->error(); @@ -197,7 +197,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDecoFail_DEPRECATED) { auto* s = Structure(Sym("S"), members, decos); - p->register_constructed("S", s); + p->register_type("S", s); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); @@ -220,7 +220,7 @@ TEST_F(ParserImplTest, auto* s = Structure(Sym("S"), members, decos); - p->register_constructed("S", s); + p->register_type("S", s); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); @@ -259,7 +259,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_NonAccessDecoFail) { auto* s = Structure(Sym("S"), members, decos); - p->register_constructed("S", s); + p->register_type("S", s); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); diff --git a/src/reader/wgsl/parser_impl_variable_stmt_test.cc b/src/reader/wgsl/parser_impl_variable_stmt_test.cc index 624b78fef1..ee6536c3ab 100644 --- a/src/reader/wgsl/parser_impl_variable_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_variable_stmt_test.cc @@ -65,7 +65,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_Invalid) { EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:9: unknown type 'invalid'"); } TEST_F(ParserImplTest, VariableStmt_VariableDecl_ConstructorInvalid) { @@ -160,7 +160,7 @@ TEST_F(ParserImplTest, VariableStmt_Let_InvalidVarIdent) { EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unknown constructed type 'invalid'"); + EXPECT_EQ(p->error(), "1:9: unknown type 'invalid'"); } TEST_F(ParserImplTest, VariableStmt_Let_MissingEqual) { diff --git a/src/resolver/resolver_test_helper.h b/src/resolver/resolver_test_helper.h index 37692fbbe0..20fc2291dc 100644 --- a/src/resolver/resolver_test_helper.h +++ b/src/resolver/resolver_test_helper.h @@ -351,7 +351,7 @@ struct DataType> { auto name = b.Symbols().Register("alias_" + std::to_string(ID)); if (!b.AST().LookupType(name)) { auto* type = DataType::AST(b); - b.AST().AddConstructedType(b.ty.alias(name, type)); + b.AST().AddTypeDecl(b.ty.alias(name, type)); } return b.create(name); } diff --git a/src/transform/canonicalize_entry_point_io.cc b/src/transform/canonicalize_entry_point_io.cc index d0ac744710..156c44e99f 100644 --- a/src/transform/canonicalize_entry_point_io.cc +++ b/src/transform/canonicalize_entry_point_io.cc @@ -75,7 +75,7 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap& data) { // Strip entry point IO decorations from struct declarations. // TODO(jrprice): This code is duplicated with the SPIR-V transform. - for (auto* ty : ctx.src->AST().ConstructedTypes()) { + for (auto* ty : ctx.src->AST().TypeDecls()) { if (auto* struct_ty = ty->As()) { // Build new list of struct members without entry point IO decorations. ast::StructMemberList new_struct_members; diff --git a/src/transform/decompose_storage_access.cc b/src/transform/decompose_storage_access.cc index 9de497cb82..b42b303156 100644 --- a/src/transform/decompose_storage_access.cc +++ b/src/transform/decompose_storage_access.cc @@ -331,8 +331,8 @@ void InsertGlobal(CloneContext& ctx, } } -/// @returns the unwrapped, user-declared constructed type of ty. -const ast::TypeDecl* ConstructedTypeOf(const sem::Type* ty) { +/// @returns the unwrapped, user-declared type of ty. +const ast::TypeDecl* TypeDeclOf(const sem::Type* ty) { while (true) { if (auto* ref = ty->As()) { ty = ref->StoreType(); @@ -341,7 +341,7 @@ const ast::TypeDecl* ConstructedTypeOf(const sem::Type* ty) { if (auto* str = ty->As()) { return str->Declaration(); } - // Not a constructed type + // Not a declared type return nullptr; } } @@ -762,7 +762,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) { auto* offset = access.offset->Build(ctx); auto* buf_ty = access.var->Type()->UnwrapRef(); auto* el_ty = access.type->UnwrapRef(); - auto* insert_after = ConstructedTypeOf(access.var->Type()); + auto* insert_after = TypeDeclOf(access.var->Type()); Symbol func = state.LoadFunc(ctx, insert_after, buf_ty, el_ty, access.var->As()); @@ -778,7 +778,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) { auto* buf_ty = store.target.var->Type()->UnwrapRef(); auto* el_ty = store.target.type->UnwrapRef(); auto* value = store.assignment->rhs(); - auto* insert_after = ConstructedTypeOf(store.target.var->Type()); + auto* insert_after = TypeDeclOf(store.target.var->Type()); Symbol func = state.StoreFunc(ctx, insert_after, buf_ty, el_ty, store.target.var->As()); diff --git a/src/transform/single_entry_point.cc b/src/transform/single_entry_point.cc index 26f12ecf9e..a926d11787 100644 --- a/src/transform/single_entry_point.cc +++ b/src/transform/single_entry_point.cc @@ -71,7 +71,7 @@ Output SingleEntryPoint::Run(const Program* in, const DataMap& data) { for (auto* decl : in->AST().GlobalDeclarations()) { if (auto* ty = decl->As()) { // TODO(jrprice): Strip unused types. - out.AST().AddConstructedType(ctx.Clone(ty)); + out.AST().AddTypeDecl(ctx.Clone(ty)); } else if (auto* var = decl->As()) { if (var->is_const() || referenced_vars.count(var)) { out.AST().AddGlobalVariable(ctx.Clone(var)); diff --git a/src/transform/spirv.cc b/src/transform/spirv.cc index e16a0f0608..616eec6c34 100644 --- a/src/transform/spirv.cc +++ b/src/transform/spirv.cc @@ -127,7 +127,7 @@ void Spirv::HandleEntryPointIOTypes(CloneContext& ctx) const { // ``` // Strip entry point IO decorations from struct declarations. - for (auto* ty : ctx.src->AST().ConstructedTypes()) { + for (auto* ty : ctx.src->AST().TypeDecls()) { if (auto* struct_ty = ty->As()) { // Build new list of struct members without entry point IO decorations. ast::StructMemberList new_struct_members; diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index db44cb5fe2..29b77ba692 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -120,15 +120,15 @@ bool GeneratorImpl::Generate(std::ostream& out) { register_global(global); } - for (auto* const ty : builder_.AST().ConstructedTypes()) { + for (auto* const ty : builder_.AST().TypeDecls()) { if (ty->Is()) { continue; } - if (!EmitConstructedType(out, TypeOf(ty))) { + if (!EmitTypeDecl(out, TypeOf(ty))) { return false; } } - if (!builder_.AST().ConstructedTypes().empty()) { + if (!builder_.AST().TypeDecls().empty()) { out << std::endl; } @@ -204,8 +204,7 @@ std::string GeneratorImpl::current_ep_var_name(VarType type) { return name; } -bool GeneratorImpl::EmitConstructedType(std::ostream& out, - const sem::Type* ty) { +bool GeneratorImpl::EmitTypeDecl(std::ostream& out, const sem::Type* ty) { make_indent(out); if (auto* str = ty->As()) { @@ -214,8 +213,7 @@ bool GeneratorImpl::EmitConstructedType(std::ostream& out, return false; } } else { - TINT_UNREACHABLE(diagnostics_) - << "constructed type: " << ty->TypeInfo().name; + TINT_UNREACHABLE(diagnostics_) << "declared type: " << ty->TypeInfo().name; return false; } diff --git a/src/writer/hlsl/generator_impl.h b/src/writer/hlsl/generator_impl.h index 57de7a374f..3c527c76c3 100644 --- a/src/writer/hlsl/generator_impl.h +++ b/src/writer/hlsl/generator_impl.h @@ -57,11 +57,11 @@ class GeneratorImpl : public TextGenerator { /// @returns true on successful generation; false otherwise bool Generate(std::ostream& out); - /// Handles generating a constructed type + /// Handles generating a declared type /// @param out the output stream - /// @param ty the constructed type to generate - /// @returns true if the constructed type was emitted - bool EmitConstructedType(std::ostream& out, const sem::Type* ty); + /// @param ty the declared type to generate + /// @returns true if the declared type was emitted + bool EmitTypeDecl(std::ostream& out, const sem::Type* ty); /// Handles an array accessor expression /// @param pre the preamble for the expression stream /// @param out the output of the expression stream diff --git a/src/writer/msl/generator_impl.cc b/src/writer/msl/generator_impl.cc index 9ebb14563d..adbcdddcf3 100644 --- a/src/writer/msl/generator_impl.cc +++ b/src/writer/msl/generator_impl.cc @@ -87,9 +87,9 @@ bool GeneratorImpl::Generate() { global_variables_.set(global->symbol(), sem); } - for (auto* const type_decl : program_->AST().ConstructedTypes()) { + for (auto* const type_decl : program_->AST().TypeDecls()) { if (!type_decl->Is()) { - if (!EmitConstructedType(TypeOf(type_decl))) { + if (!EmitTypeDecl(TypeOf(type_decl))) { return false; } } @@ -105,7 +105,7 @@ bool GeneratorImpl::Generate() { } } - if (!program_->AST().ConstructedTypes().empty() || array_wrappers_.size()) { + if (!program_->AST().TypeDecls().empty() || array_wrappers_.size()) { out_ << std::endl; } @@ -160,7 +160,7 @@ bool GeneratorImpl::Generate() { return true; } -bool GeneratorImpl::EmitConstructedType(const sem::Type* ty) { +bool GeneratorImpl::EmitTypeDecl(const sem::Type* ty) { make_indent(); if (auto* str = ty->As()) { @@ -2011,7 +2011,7 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) { out_ << "sampler"; } else if (auto* str = type->As()) { // The struct type emits as just the name. The declaration would be emitted - // as part of emitting the constructed types. + // as part of emitting the declared types. out_ << program_->Symbols().NameFor(str->Declaration()->name()); } else if (auto* tex = type->As()) { if (tex->Is()) { diff --git a/src/writer/msl/generator_impl.h b/src/writer/msl/generator_impl.h index 72e37391b9..9a417eec09 100644 --- a/src/writer/msl/generator_impl.h +++ b/src/writer/msl/generator_impl.h @@ -61,10 +61,10 @@ class GeneratorImpl : public TextGenerator { /// @returns true on successful generation; false otherwise bool Generate(); - /// Handles generating a constructed - /// @param ty the constructed type to generate - /// @returns true if the constructed type was emitted - bool EmitConstructedType(const sem::Type* ty); + /// Handles generating a declared type + /// @param ty the declared type to generate + /// @returns true if the declared type was emitted + bool EmitTypeDecl(const sem::Type* ty); /// Handles an array accessor expression /// @param expr the expression to emit /// @returns true if the array accessor was emitted diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc index 006b7999dd..8dc1c0195e 100644 --- a/src/writer/wgsl/generator_impl.cc +++ b/src/writer/wgsl/generator_impl.cc @@ -67,7 +67,7 @@ bool GeneratorImpl::Generate() { // Generate global declarations in the order they appear in the module. for (auto* decl : program_->AST().GlobalDeclarations()) { if (auto* td = decl->As()) { - if (!EmitConstructedType(td)) { + if (!EmitTypeDecl(td)) { return false; } } else if (auto* func = decl->As()) { @@ -91,7 +91,7 @@ bool GeneratorImpl::Generate() { return true; } -bool GeneratorImpl::EmitConstructedType(const ast::TypeDecl* ty) { +bool GeneratorImpl::EmitTypeDecl(const ast::TypeDecl* ty) { make_indent(); if (auto* alias = ty->As()) { @@ -105,7 +105,7 @@ bool GeneratorImpl::EmitConstructedType(const ast::TypeDecl* ty) { return false; } } else { - diagnostics_.add_error("unknown constructed type: " + + diagnostics_.add_error("unknown declared type: " + std::string(ty->TypeInfo().name)); return false; } diff --git a/src/writer/wgsl/generator_impl.h b/src/writer/wgsl/generator_impl.h index 4d48d76837..ad9f535abc 100644 --- a/src/writer/wgsl/generator_impl.h +++ b/src/writer/wgsl/generator_impl.h @@ -54,10 +54,10 @@ class GeneratorImpl : public TextGenerator { /// @returns true on successful generation; false otherwise bool Generate(); - /// Handles generating a constructed type - /// @param ty the constructed to generate - /// @returns true if the constructed was emitted - bool EmitConstructedType(const ast::TypeDecl* ty); + /// Handles generating a declared type + /// @param ty the declared type to generate + /// @returns true if the declared type was emitted + bool EmitTypeDecl(const ast::TypeDecl* ty); /// Handles an array accessor expression /// @param expr the expression to emit /// @returns true if the array accessor was emitted diff --git a/src/writer/wgsl/generator_impl_alias_type_test.cc b/src/writer/wgsl/generator_impl_alias_type_test.cc index 43c52706f6..754849dc31 100644 --- a/src/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/writer/wgsl/generator_impl_alias_type_test.cc @@ -26,12 +26,12 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_F32) { GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitConstructedType(alias)) << gen.error(); + ASSERT_TRUE(gen.EmitTypeDecl(alias)) << gen.error(); EXPECT_EQ(gen.result(), R"(type a = f32; )"); } -TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) { +TEST_F(WgslGeneratorImplTest, EmitTypeDecl_Struct) { auto* s = Structure("A", { Member("a", ty.f32()), Member("b", ty.i32()), @@ -41,8 +41,8 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) { GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitConstructedType(s)) << gen.error(); - ASSERT_TRUE(gen.EmitConstructedType(alias)) << gen.error(); + ASSERT_TRUE(gen.EmitTypeDecl(s)) << gen.error(); + ASSERT_TRUE(gen.EmitTypeDecl(alias)) << gen.error(); EXPECT_EQ(gen.result(), R"(struct A { a : f32; b : i32; @@ -61,7 +61,7 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) { GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitConstructedType(alias)) << gen.error(); + ASSERT_TRUE(gen.EmitTypeDecl(alias)) << gen.error(); EXPECT_EQ(gen.result(), R"(type B = A; )"); }