Minor fix to forEach on Yul AST nodes.

This commit is contained in:
Daniel Kirchner 2021-11-05 13:03:13 +01:00
parent d6cb42c9dd
commit b4f98b41bc

View File

@ -111,8 +111,7 @@ template <
>
struct ForEach: Base
{
template<typename Callable>
ForEach(Callable&& _visitor): visitor(std::forward<Callable>(_visitor)) {}
ForEach(Visitor& _visitor): visitor(_visitor) {}
using Base::operator();
void operator()(Node& _node) override
@ -121,7 +120,7 @@ struct ForEach: Base
Base::operator()(_node);
}
Visitor visitor;
Visitor& visitor;
};
}
@ -130,7 +129,7 @@ struct ForEach: Base
template<typename Node, typename Entry, typename Visitor>
void forEach(Entry&& _entry, Visitor&& _visitor)
{
detail::ForEach<Node, std::decay_t<Visitor>>{std::forward<Visitor>(_visitor)}(std::forward<Entry>(_entry));
detail::ForEach<Node, Visitor&>{_visitor}(_entry);
}
}