void
Dump::do_pathpattern (PathPattern &e)
{
+ if (e.get_path_kind () == PathPattern::Kind::LangItem)
+ {
+ put_field ("segments", "#[lang = \""
+ + LangItem::ToString (e.get_lang_item ())
+ + "\"]");
+ return;
+ }
+
std::string str = "";
for (const auto &segment : e.get_segments ())
Dump::do_qualifiedpathtype (QualifiedPathType &e)
{
do_mappings (e.get_mappings ());
- visit_field ("type", e.get_type ());
+ if (e.has_type ())
+ visit_field ("type", e.get_type ());
+ else
+ put_field ("type", "none");
- if (e.has_as_clause ())
+ if (e.has_trait ())
visit_field ("trait", e.get_trait ());
}
if (e.has_return_type ())
visit_field ("return_type", e.get_return_type ());
+ else
+ put_field ("return_type", "none");
if (e.has_where_clause ())
put_field ("where_clause", e.get_where_clause ().as_string ());
if (e.has_break_expr ())
visit_field ("break_expr ", e.get_expr ());
+ else
+ put_field ("break_expr", "none");
end ("BreakExpr");
}
Analysis::NodeMapping get_mappings () const { return mappings; }
+ bool has_type () { return type != nullptr; }
+ bool has_trait () { return trait != nullptr; }
+
Type &get_type ()
{
rust_assert (type);
return *type;
}
- TypePath &get_trait () { return *trait; }
+ TypePath &get_trait ()
+ {
+ rust_assert (trait);
+ return *trait;
+ }
bool trait_has_generic_args () const;