1
0
Fork 0

Make iterator [*] internal variables need no register.

This commit is contained in:
Max Neunhoeffer 2014-08-11 13:47:23 +02:00
parent dd01a7510c
commit 8290bc64fb
4 changed files with 20 additions and 4 deletions

View File

@ -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);
}
}
};

View File

@ -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);

View File

@ -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
////////////////////////////////////////////////////////////////////////////////

View File

@ -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);