gccrs: dump: Dump items within modules
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 27 Sep 2022 13:52:57 +0000 (15:52 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:35 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly.

gcc/rust/ast/rust-ast-dump.cc

index b7557bd..653c1d9 100644 (file)
@@ -809,7 +809,23 @@ Dump::visit (Method &method)
 
 void
 Dump::visit (Module &module)
-{}
+{
+  indentation.increment ();
+
+  stream << indentation;
+  emit_visibility (module.get_visibility ());
+  stream << "mod" << module.get_name () << " {\n";
+
+  for (auto &item : module.get_items ())
+    {
+      stream << indentation;
+      item->accept_vis (*this);
+      stream << '\n';
+    }
+
+  indentation.decrement ();
+  stream << indentation << "}\n";
+}
 
 void
 Dump::visit (ExternCrate &crate)