attributes: Allow stripping assignment expressions

This commit is contained in:
Arthur Cohen 2022-03-25 11:13:29 +01:00
parent 89ad4f21f2
commit 2249a4d512
2 changed files with 12 additions and 4 deletions

View File

@ -628,8 +628,12 @@ AttrVisitor::visit (AST::TypeCastExpr &expr)
void
AttrVisitor::visit (AST::AssignmentExpr &expr)
{
/* outer attributes never allowed before these. while cannot strip
* two direct descendant expressions, can strip ones below that */
expander.expand_cfg_attrs (expr.get_outer_attrs ());
if (expander.fails_cfg_with_expand (expr.get_outer_attrs ()))
{
expr.mark_for_strip ();
return;
}
/* should have no possibility for outer attrs as would be parsed
* with outer expr */

View File

@ -71,8 +71,12 @@ public:
it = values.erase (it);
for (auto &node : fragment.get_nodes ())
{
it = values.insert (it, extractor (node));
it++;
auto new_node = extractor (node);
if (new_node != nullptr && !new_node->is_marked_for_strip ())
{
it = values.insert (it, std::move (new_node));
it++;
}
}
}
else if (value->is_marked_for_strip ())