cmDefinitions: Make the ClosureKeys method static.

For consistency with all other closure-related methods.
This commit is contained in:
Stephen Kelly 2015-05-16 05:33:30 +02:00
parent 98c5c90361
commit f170985e7a
3 changed files with 17 additions and 19 deletions

View File

@ -105,12 +105,16 @@ cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin,
//----------------------------------------------------------------------------
std::vector<std::string>
cmDefinitions::ClosureKeys(std::set<std::string>& bound) const
cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end)
{
std::set<std::string> bound;
std::vector<std::string> defined;
defined.reserve(this->Map.size());
for(MapType::const_iterator mi = this->Map.begin();
mi != this->Map.end(); ++mi)
for (StackConstIter it = begin; it != end; ++it)
{
defined.reserve(defined.size() + it->Map.size());
for(MapType::const_iterator mi = it->Map.begin();
mi != it->Map.end(); ++mi)
{
// Use this key if it is not already set or unset.
if(bound.insert(mi->first).second && mi->second.Exists)
@ -118,5 +122,7 @@ cmDefinitions::ClosureKeys(std::set<std::string>& bound) const
defined.push_back(mi->first);
}
}
}
return defined;
}

View File

@ -44,8 +44,8 @@ public:
/** Get the set of all local keys. */
std::vector<std::string> LocalKeys() const;
std::vector<std::string>
ClosureKeys(std::set<std::string>& bound) const;
static std::vector<std::string> ClosureKeys(StackConstIter begin,
StackConstIter end);
static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end);

View File

@ -94,16 +94,8 @@ public:
std::vector<std::string> ClosureKeys() const
{
std::vector<std::string> closureKeys;
std::set<std::string> bound;
for (std::list<cmDefinitions>::const_reverse_iterator it =
this->VarStack.rbegin(); it != this->VarStack.rend(); ++it)
{
std::vector<std::string> const& localKeys = it->ClosureKeys(bound);
closureKeys.insert(closureKeys.end(),
localKeys.begin(), localKeys.end());
}
return closureKeys;
return cmDefinitions::ClosureKeys(this->VarStack.rbegin(),
this->VarStack.rend());
}
void PopDefinitions()