mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- ::findModifications code cleanup. - ::findStrayModifications now prunes nodes out of the iterator loop.
This commit is contained in:
parent
13e49f6b00
commit
e353d8eb8b
1 changed files with 9 additions and 7 deletions
|
@ -1616,7 +1616,6 @@ void Parser::findModifications ()
|
||||||
{
|
{
|
||||||
(*i)->unTag ("?");
|
(*i)->unTag ("?");
|
||||||
(*i)->tag ("MODIFICATION");
|
(*i)->tag ("MODIFICATION");
|
||||||
// (*i)->removeAllBranches ();
|
|
||||||
prune.push_back (*i);
|
prune.push_back (*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1633,12 +1632,12 @@ void Parser::findModifications ()
|
||||||
void Parser::findStrayModifications ()
|
void Parser::findStrayModifications ()
|
||||||
{
|
{
|
||||||
context.debug ("Parser::findStrayModifications");
|
context.debug ("Parser::findStrayModifications");
|
||||||
bool action = false;
|
|
||||||
|
|
||||||
std::string command = getCommand ();
|
std::string command = getCommand ();
|
||||||
if (command == "add" ||
|
if (command == "add" ||
|
||||||
command == "log")
|
command == "log")
|
||||||
{
|
{
|
||||||
|
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;
|
||||||
|
@ -1648,14 +1647,17 @@ void Parser::findStrayModifications ()
|
||||||
{
|
{
|
||||||
(*i)->unTag ("FILTER");
|
(*i)->unTag ("FILTER");
|
||||||
(*i)->tag ("MODIFICATION");
|
(*i)->tag ("MODIFICATION");
|
||||||
(*i)->removeAllBranches ();
|
prune.push_back (*i);
|
||||||
action = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (action)
|
// Prune branches outside the loop.
|
||||||
context.debug (_tree->dump ());
|
for (i = prune.begin (); i != prune.end (); ++i)
|
||||||
|
(*i)->removeAllBranches ();
|
||||||
|
|
||||||
|
if (prune.size ())
|
||||||
|
context.debug (_tree->dump ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue