Merge topic 'refactor-RaiseScope'

e8ae46e5 cmMakefile: Implement RaiseScope without relying on Parent.
30a021cc cmMakefile: Implement RaiseScope in terms of local Get method.
This commit is contained in:
Brad King 2015-05-01 13:16:16 -04:00 committed by CMake Topic Stage
commit 514640411a
1 changed files with 24 additions and 20 deletions

View File

@ -117,16 +117,13 @@ public:
bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf)
{
cmDefinitions& cur = this->VarStack.back();
if(cmDefinitions* up = cur.GetParent())
{
// First localize the definition in the current scope.
cur.Get(var);
assert(this->VarStack.size() > 0);
// Now update the definition in the parent scope.
up->Set(var, varDef);
}
else if(cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent())
std::list<cmDefinitions>::reverse_iterator it = this->VarStack.rbegin();
++it;
if(it == this->VarStack.rend())
{
if(cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent())
{
// Update the definition in the parent directory top scope. This
// directory's scope was initialized by the closure of the parent
@ -140,11 +137,18 @@ public:
{
parent->RemoveDefinition(var);
}
return true;
}
else
{
return false;
}
}
// First localize the definition in the current scope.
this->GetDefinition(var);
// Now update the definition in the parent scope.
it->Set(var, varDef);
return true;
}
};