gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Dump::visit): Add new visit function for overloading.
* ast/rust-ast-dump.h: Add documentation for layer.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
item.accept_vis (*this);
}
+template <typename T>
+void
+Dump::visit (std::unique_ptr<T> &node)
+{
+ node->accept_vis (*this);
+}
+
void
Dump::format_function_param (FunctionParam ¶m)
{
std::ostream &stream;
Indent indentation;
+ /**
+ * Compatibility layer for using the visitor pattern on polymorphic classes
+ * with a unified overload syntax. This allows us to call `visit` both on
+ * types implementing `accept_vis` method and for classes for which the
+ * `visit` method is directly implemented.
+ */
+ template <typename T> void visit (std::unique_ptr<T> &node);
+
/**
* Format together common items of functions: Parameters, return type, block
*/