cmDefinitions: Externalize the Set logic.
This commit is contained in:
parent
60200ca508
commit
5067ae41b0
|
@ -49,16 +49,7 @@ const char* cmDefinitions::Get(const std::string& key)
|
|||
void cmDefinitions::Set(const std::string& key, const char* value)
|
||||
{
|
||||
Def def(value);
|
||||
if(this->Up || def.Exists)
|
||||
{
|
||||
// In lower scopes we store keys, defined or not.
|
||||
this->Map[key] = def;
|
||||
}
|
||||
else
|
||||
{
|
||||
// In the top-most scope we need not store undefined keys.
|
||||
this->Map.erase(key);
|
||||
}
|
||||
this->Map[key] = def;
|
||||
}
|
||||
|
||||
void cmDefinitions::Erase(const std::string& key)
|
||||
|
|
|
@ -78,7 +78,15 @@ public:
|
|||
|
||||
void RemoveDefinition(std::string const& name)
|
||||
{
|
||||
this->VarStack.top().Set(name, 0);
|
||||
if (this->VarStack.size() > 1)
|
||||
{
|
||||
// In lower scopes we store keys, defined or not.
|
||||
this->VarStack.top().Set(name, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->VarStack.top().Erase(name);
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> LocalKeys() const
|
||||
|
|
Loading…
Reference in New Issue