Avoid context searching on execution
In order to treat correctly context changes (on function calls essentially), one needs to retrieve in which context a local variable was created.
To simplify implementation, in LocalNameProcessor
one defines
DataVariant
execute(ExecutionPolicy& exec_policy)
{
return exec_policy.contextOfId(m_context_id)[m_value_id];
}
in which contextOfId(m_context_id)
performs a research of the context
Context&
contextOfId(const int32_t& context_id)
{
for (auto i_context = m_context_list.rbegin(); i_context != m_context_list.rend(); ++i_context) {
if (i_context->id() == context_id) {
return *i_context;
}
}
throw std::invalid_argument{"unable to find context"};
}
Obviously, this search could be performed only once, replacing the context research by storing the context shift (that is the number of parent to traverse to catch the right context)
This is not a priority fix, but must be kept in mind.
Edited by Stéphane Del Pino