return path_str + attr_input->as_string ();
}
+bool
+Attribute::is_derive () const
+{
+ return has_attr_input ()
+ && get_attr_input ().get_attr_input_type ()
+ == AST::AttrInput::TOKEN_TREE
+ && get_path () == "derive";
+}
+
// Copy constructor must deep copy attr_input as unique pointer
Attribute::Attribute (Attribute const &other)
: path (other.path), locus (other.locus)
namespace Rust {
-bool
-is_derive (AST::Attribute &attr)
-{
- auto path = attr.get_path ();
- return attr.has_attr_input ()
- && attr.get_attr_input ().get_attr_input_type ()
- == AST::AttrInput::TOKEN_TREE
- && path == "derive";
-}
-
bool
is_builtin (AST::Attribute &attr)
{
{
auto current = *attr_it;
- if (is_derive (current))
+ if (current.is_derive ())
{
current.parse_attr_to_meta_item ();
attr_it = attrs.erase (attr_it);
{
auto current = *attr_it;
- if (is_derive (current))
+ if (current.is_derive ())
{
attr_it = attrs.erase (attr_it);
// Get traits to derive in the current attribute
{
auto current = *it;
- if (!is_builtin (current) && !is_derive (current))
+ if (!is_builtin (current) && !current.is_derive ())
{
it = attrs.erase (it);
expand_inner_attribute (item, current.get_path ());