diff options
author | Zheyuan Chen <sephirotheca17@gmail.com> | 2023-04-13 05:57:31 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-20 07:51:02 +0000 |
commit | 3013c408b0d34cd9e2f3906132f6b5ff26cd5966 (patch) | |
tree | 16ab31110657774aa668f21bd5b01b2b7cf5d8e7 | |
parent | ab4931bf811646b8f6a46af024d8156c8c56e33f (diff) | |
download | gcc-3013c408b0d34cd9e2f3906132f6b5ff26cd5966.zip gcc-3013c408b0d34cd9e2f3906132f6b5ff26cd5966.tar.gz gcc-3013c408b0d34cd9e2f3906132f6b5ff26cd5966.tar.bz2 |
Implement Dump:visit() function for QualifiedPathInType argument.
gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc: fix bad formatting for associated type.
Signed-off-by: Zheyuan Chen <sephirotheca17@gmail.com>
-rw-r--r-- | gcc/rust/ast/rust-ast-dump.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 34cc4b0..c5c3300d 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -488,8 +488,20 @@ Dump::visit (QualifiedPathInExpression &path) } void -Dump::visit (QualifiedPathInType &) -{} +Dump::visit (QualifiedPathInType &path) +{ + auto qualified_path_type = path.get_qualified_path_type (); + stream << "<"; + visit (qualified_path_type.get_type ()); + if (qualified_path_type.has_as_clause ()) + { + stream << " as "; + visit (qualified_path_type.get_as_type_path ()); + } + stream << ">::"; + visit (path.get_associated_segment ()); + visit_items_joined_by_separator (path.get_segments (), "::"); +} // rust-expr.h void @@ -1153,7 +1165,6 @@ Dump::visit (TypeAlias &type_alias) // Visibility? type IDENTIFIER GenericParams? WhereClause? = Type; // Note: Associated types are handled by `AST::TraitItemType`. - if (type_alias.has_visibility ()) visit (type_alias.get_visibility ()); stream << "type " << type_alias.get_new_type_name (); @@ -1163,6 +1174,7 @@ Dump::visit (TypeAlias &type_alias) visit (type_alias.get_where_clause ()); stream << " = "; visit (type_alias.get_type_aliased ()); + stream << ";\n"; } void |