replace the global contextTask with a Context field

This commit is contained in:
Dustin J. Mitchell
2021-12-18 02:37:41 +00:00
committed by Tomas Babej
parent 53127bf844
commit 65830dd705
4 changed files with 16 additions and 17 deletions

View File

@@ -35,10 +35,6 @@
#include <format.h>
#include <shared.h>
////////////////////////////////////////////////////////////////////////////////
// Context for DOM evaluations
const Task* contextTask = NULL;
////////////////////////////////////////////////////////////////////////////////
// Take an input set of tasks and filter into a subset.
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output)
@@ -66,7 +62,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
for (auto& task : input)
{
// Set up context for any DOM references.
contextTask = &task;
auto currentTask = Context::getContext ().withCurrentTask(&task);
Variant var;
eval.evaluateCompiledExpression (var);
@@ -118,7 +114,7 @@ void Filter::subset (std::vector <Task>& output)
for (auto& task : pending)
{
// Set up context for any DOM references.
contextTask = &task;
auto currentTask = Context::getContext ().withCurrentTask(&task);
Variant var;
eval.evaluateCompiledExpression (var);
@@ -137,7 +133,7 @@ void Filter::subset (std::vector <Task>& output)
for (auto& task : completed)
{
// Set up context for any DOM references.
contextTask = &task;
auto currentTask = Context::getContext ().withCurrentTask(&task);
Variant var;
eval.evaluateCompiledExpression (var);