mirror of https://gitee.com/bigwinds/arangodb
Make iterator [*] internal variables need no register.
This commit is contained in:
parent
dd01a7510c
commit
8290bc64fb
|
@ -886,8 +886,10 @@ std::unordered_set<Variable*> Ast::getReferencedVariables (AstNode const* node)
|
|||
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
auto result = static_cast<std::unordered_set<Variable*>*>(data);
|
||||
result->insert(variable);
|
||||
if (variable->needsRegister()) {
|
||||
auto result = static_cast<std::unordered_set<Variable*>*>(data);
|
||||
result->insert(variable);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1426,6 +1426,9 @@ namespace triagens {
|
|||
auto en = static_cast<CalculationNode const*>(getPlanNode());
|
||||
|
||||
std::unordered_set<Variable*> inVars = _expression->variables();
|
||||
for (auto it : inVars) {
|
||||
std::cout << it->name << ":" << it->id << std::endl;
|
||||
}
|
||||
|
||||
for (auto it = inVars.begin(); it != inVars.end(); ++it) {
|
||||
_inVars.push_back(*it);
|
||||
|
|
|
@ -109,10 +109,21 @@ namespace triagens {
|
|||
|
||||
inline bool isUserDefined () const {
|
||||
char const c = name[0];
|
||||
// variables starting with a number are user-defined
|
||||
// variables starting with a number are not user-defined
|
||||
return (c < '0' || c > '9');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not the variable needs a register assigned
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool needsRegister () const {
|
||||
char const cf = name[0];
|
||||
char const cb = name.back();
|
||||
// variables starting with a number are not user-defined
|
||||
return (cf < '0' || cf > '9') || cb != '_';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a JSON representation of the variable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -689,7 +689,7 @@ reference:
|
|||
// expanded variable access, e.g. variable[*]
|
||||
|
||||
// create a temporary iterator variable
|
||||
std::string const nextName = parser->ast()->variables()->nextName();
|
||||
std::string const nextName = parser->ast()->variables()->nextName() + "_";
|
||||
char const* iteratorName = nextName.c_str();
|
||||
auto iterator = parser->ast()->createNodeIterator(iteratorName, $1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue