public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Implement Dump:visit() function for QualifiedPathInType argument.
@ 2023-05-02  7:08 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-05-02  7:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3013c408b0d34cd9e2f3906132f6b5ff26cd5966

commit 3013c408b0d34cd9e2f3906132f6b5ff26cd5966
Author: Zheyuan Chen <sephirotheca17@gmail.com>
Date:   Thu Apr 13 05:57:31 2023 -0700

    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>

Diff:
---
 gcc/rust/ast/rust-ast-dump.cc | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index 34cc4b01065..c5c3300dbf9 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-02  7:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  7:08 [gcc/devel/rust/master] Implement Dump:visit() function for QualifiedPathInType argument Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).