cmDefinitions: Replace private constructor with MakeClosure.
This commit is contained in:
parent
012a75a00f
commit
24885d4efa
|
@ -75,21 +75,16 @@ std::vector<std::string> cmDefinitions::LocalKeys() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmDefinitions cmDefinitions::Closure() const
|
||||
{
|
||||
return cmDefinitions(ClosureTag(), this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmDefinitions::cmDefinitions(ClosureTag const&, cmDefinitions const* root):
|
||||
Up(0)
|
||||
cmDefinitions cmDefinitions::MakeClosure() const
|
||||
{
|
||||
std::set<std::string> undefined;
|
||||
this->ClosureImpl(undefined, root);
|
||||
cmDefinitions closure;
|
||||
closure.MakeClosure(undefined, this);
|
||||
return closure;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
|
||||
void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
|
||||
cmDefinitions const* defs)
|
||||
{
|
||||
// Consider local definitions.
|
||||
|
@ -114,7 +109,7 @@ void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
|
|||
// Traverse parents.
|
||||
if(cmDefinitions const* up = defs->Up)
|
||||
{
|
||||
this->ClosureImpl(undefined, up);
|
||||
this->MakeClosure(undefined, up);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,13 +45,11 @@ public:
|
|||
/** Get the set of all local keys. */
|
||||
std::vector<std::string> LocalKeys() const;
|
||||
|
||||
/** Compute the closure of all defined keys with values.
|
||||
This flattens the scope. The result has no parent. */
|
||||
cmDefinitions Closure() const;
|
||||
|
||||
/** Compute the set of all defined keys. */
|
||||
std::vector<std::string> ClosureKeys() const;
|
||||
|
||||
cmDefinitions MakeClosure() const;
|
||||
|
||||
private:
|
||||
// String with existence boolean.
|
||||
struct Def: public std::string
|
||||
|
@ -81,10 +79,7 @@ private:
|
|||
// Internal query and update methods.
|
||||
Def const& GetInternal(const std::string& key);
|
||||
|
||||
// Implementation of Closure() method.
|
||||
struct ClosureTag {};
|
||||
cmDefinitions(ClosureTag const&, cmDefinitions const* root);
|
||||
void ClosureImpl(std::set<std::string>& undefined,
|
||||
void MakeClosure(std::set<std::string>& undefined,
|
||||
cmDefinitions const* defs);
|
||||
};
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
void InitializeDefinitions(cmMakefile* parent)
|
||||
{
|
||||
this->VarStack.top() = parent->Internal->VarStack.top().Closure();
|
||||
this->VarStack.top() = parent->Internal->VarStack.top().MakeClosure();
|
||||
}
|
||||
|
||||
const char* GetDefinition(std::string const& name)
|
||||
|
|
Loading…
Reference in New Issue