aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-dump.cc32
1 files changed, 28 insertions, 4 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index a06dd72..9af8fa8 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -48,7 +48,11 @@ void
Dump::go (AST::Crate &crate)
{
for (auto &item : crate.items)
- item->accept_vis (*this);
+ {
+ stream << indentation;
+ item->accept_vis (*this);
+ stream << "\n";
+ }
}
void
@@ -401,8 +405,12 @@ Dump::visit (AsyncBlockExpr &expr)
void
Dump::visit (TypeParam &param)
{
- // Is it possible to have a null type here?
- param.get_type ()->accept_vis (*this);
+ stream << param.get_type_representation ();
+ if (param.has_type ())
+ {
+ stream << ": ";
+ param.get_type ()->accept_vis (*this);
+ }
}
void
@@ -473,8 +481,24 @@ Dump::visit (UseDeclaration &use_decl)
void
Dump::visit (Function &function)
{
- stream << indentation << "fn " << function.get_function_name () << '(';
+ stream << "fn " << function.get_function_name ();
+
+ if (function.has_generics ())
+ {
+ stream << "<";
+ for (size_t i = 0; i < function.get_generic_params ().size (); i++)
+ {
+ auto &param = function.get_generic_params ().at (i);
+ param->accept_vis (*this);
+
+ bool has_next = (i + 1) < function.get_generic_params ().size ();
+ if (has_next)
+ stream << ", ";
+ }
+ stream << ">";
+ }
+ stream << '(';
auto &params = function.get_function_params ();
if (params.size () >= 1)
{