Skip to content

Commit 9eab71f

Browse files
jdupakCohenArthur
authored andcommitted
ast: dump TypeAlias
Signed-off-by: Jakub Dupak <[email protected]>
1 parent 3554037 commit 9eab71f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ Dump::visit (Function &function)
836836
{
837837
emit_visibility (function.get_visibility ());
838838
stream << "fn " << function.get_function_name ();
839-
840839
if (function.has_generics ())
841840
emit_generic_params (function.get_generic_params ());
842841

@@ -872,7 +871,24 @@ Dump::visit (Function &function)
872871

873872
void
874873
Dump::visit (TypeAlias &type_alias)
875-
{}
874+
{
875+
// Syntax:
876+
// Visibility? type IDENTIFIER GenericParams? WhereClause? = Type;
877+
878+
// Note: Associated types are handled by `AST::TraitItemType`.
879+
880+
if (type_alias.has_visibility ())
881+
emit_visibility (type_alias.get_visibility ());
882+
stream << "type " << type_alias.get_new_type_name ();
883+
if (type_alias.has_generics ())
884+
emit_generic_params (type_alias.get_generic_params ());
885+
if (type_alias.has_where_clause ())
886+
{
887+
} // FIXME: WhereClause
888+
stream << " = ";
889+
type_alias.get_type_aliased ()->accept_vis (*this);
890+
stream << ";\n";
891+
}
876892

877893
void
878894
Dump::visit (StructStruct &struct_item)

0 commit comments

Comments
 (0)