- ::findModifications moves branch pruning out of the iterated loop.
This commit is contained in:
Paul Beckingham 2014-08-22 23:52:24 -04:00
parent d6ad010085
commit 4a07f4e546

View file

@ -1583,9 +1583,9 @@ void Parser::findFilter ()
void Parser::findModifications () void Parser::findModifications ()
{ {
context.debug ("Parser::findModifications"); context.debug ("Parser::findModifications");
bool action = false;
bool after_writecmd = false; bool after_writecmd = false;
std::vector <Tree*> prune;
std::vector <Tree*> nodes; std::vector <Tree*> nodes;
collect (nodes, collectAll); collect (nodes, collectAll);
std::vector <Tree*>::iterator i; std::vector <Tree*>::iterator i;
@ -1604,12 +1604,16 @@ void Parser::findModifications ()
{ {
(*i)->unTag ("?"); (*i)->unTag ("?");
(*i)->tag ("MODIFICATION"); (*i)->tag ("MODIFICATION");
(*i)->removeAllBranches (); // (*i)->removeAllBranches ();
action = true; prune.push_back (*i);
} }
} }
if (action) // Prune branches outside the loop.
for (i = prune.begin (); i != prune.end (); ++i)
(*i)->removeAllBranches ();
if (prune.size ())
context.debug (_tree->dump ()); context.debug (_tree->dump ());
} }