diff options
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r-- | Source/cmDefinitions.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 61328be..94d27c2 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmDefinitions.h" +#include <assert.h> + //---------------------------------------------------------------------------- cmDefinitions::Def cmDefinitions::NoDef; @@ -21,28 +23,33 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent) } //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key) +cmDefinitions::Def const& cmDefinitions::GetInternal( + const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { + assert(&*rbegin == this); MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) { return i->second; } - cmDefinitions* up = this->Up; - if(!up) + ++rbegin; + if(rbegin == rend) { return this->NoDef; } // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); + Def def = rbegin->GetInternal(key, rbegin, rend); return this->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) +const char* cmDefinitions::Get(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { - Def const& def = this->GetInternal(key); + Def const& def = this->GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } |