1
0
Fork 0

Return the variables that expressions use too in getVariablesUsedHere()

This commit is contained in:
Wilfried Goesgens 2015-11-06 15:50:59 +01:00
parent 7a54982eb4
commit 9ad613a0a8
2 changed files with 32 additions and 3 deletions

View File

@ -372,6 +372,29 @@ void TraversalNode::fillTraversalOptions (basics::traverser::TraverserOptions& o
}
////////////////////////////////////////////////////////////////////////////////
/// @brief remember the condition to execute for early traversal abortion.
////////////////////////////////////////////////////////////////////////////////
void TraversalNode::setCondition(triagens::aql::Condition* condition){
std::unordered_set<Variable const*> varsUsedByCondition;
Ast::getReferencedVariables(condition->root(), varsUsedByCondition);
for (auto oneVar : varsUsedByCondition) {
if ((oneVar->id != _vertexOutVariable->id) &&
(oneVar->id != _edgeOutVariable->id) &&
(oneVar->id != _pathOutVariable->id) &&
(oneVar->id != _inVariable->id)) {
_conditionVariables.push_back(oneVar);
}
}
_condition = condition;
}
// Local Variables:

View File

@ -146,6 +146,9 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
void getVariablesUsedHere (std::unordered_set<Variable const*>& result) const override final {
for (auto condVar : _conditionVariables) {
result.emplace(condVar);
}
if (usesInVariable()) {
result.emplace(_inVariable);
}
@ -290,9 +293,7 @@ namespace triagens {
/// @brief remember the condition to execute for early traversal abortion.
////////////////////////////////////////////////////////////////////////////////
void setCondition(Condition* condition) {
_condition = condition;
}
void setCondition(Condition* condition);
////////////////////////////////////////////////////////////////////////////////
/// @brief return the condition for the node
@ -399,6 +400,11 @@ namespace triagens {
Condition* _condition;
////////////////////////////////////////////////////////////////////////////////
/// @brief variables that are inside of the condition
////////////////////////////////////////////////////////////////////////////////
std::vector<Variable const*> _conditionVariables;
};
} // namespace triagens::aql