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>
This commit is contained in:
dan sinclair 2021-01-11 16:24:32 +00:00 committed by dan sinclair
parent 396b02342f
commit 1d967e3228
3 changed files with 3 additions and 5 deletions

View File

@ -39,8 +39,6 @@ class Alias : public Castable<Alias, Type> {
/// @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_; }

View File

@ -238,7 +238,7 @@ bool GeneratorImpl::EmitConstructedType(std::ostream& out,
// 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;

View File

@ -175,7 +175,7 @@ bool GeneratorImpl::GenerateEntryPoint(ast::PipelineStage stage,
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 @@ bool GeneratorImpl::EmitType(ast::type::Type* type) {
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>()) {