Remove the AliasType::name() getter.
This CL removes the name() method from AliasType and replaces with
usages through the Symbol.
Change-Id: I50a85e4262e488adf935b9a484214fc85a966301
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36781
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/ast/type/alias_type.h b/src/ast/type/alias_type.h
index d90a99e..7fd0a30 100644
--- a/src/ast/type/alias_type.h
+++ b/src/ast/type/alias_type.h
@@ -39,8 +39,6 @@
/// @returns the alias symbol
Symbol symbol() const { return symbol_; }
- /// @returns the alias name
- const std::string& name() const { return name_; }
/// @returns the alias type
Type* type() const { return subtype_; }
diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc
index 051e81f..e7f957d 100644
--- a/src/writer/hlsl/generator_impl.cc
+++ b/src/writer/hlsl/generator_impl.cc
@@ -238,7 +238,7 @@
// HLSL typedef is for intrinsic types only. For an alias'd struct,
// generate a secondary struct with the new name.
if (auto* str = alias->type()->As<ast::type::Struct>()) {
- if (!EmitStructType(out, str, alias->name())) {
+ if (!EmitStructType(out, str, namer_->NameFor(alias->symbol()))) {
return false;
}
return true;
diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc
index 09509b4..c8f868f 100644
--- a/src/writer/wgsl/generator_impl.cc
+++ b/src/writer/wgsl/generator_impl.cc
@@ -175,7 +175,7 @@
bool GeneratorImpl::EmitConstructedType(const ast::type::Type* ty) {
make_indent();
if (auto* alias = ty->As<ast::type::Alias>()) {
- out_ << "type " << alias->name() << " = ";
+ out_ << "type " << module_.SymbolToName(alias->symbol()) << " = ";
if (!EmitType(alias->type())) {
return false;
}
@@ -414,7 +414,7 @@
return false;
}
} else if (auto* alias = type->As<ast::type::Alias>()) {
- out_ << alias->name();
+ out_ << module_.SymbolToName(alias->symbol());
} else if (auto* ary = type->As<ast::type::Array>()) {
for (auto* deco : ary->decorations()) {
if (auto* stride = deco->As<ast::StrideDecoration>()) {