aboutsummaryrefslogtreecommitdiff
path: root/build/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-17 11:18:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-17 11:18:10 +0200
commit0d5234f4aefd3cc5b5948cc1b9dd009e50046f5e (patch)
treeb8b3bdfe8e3a6f688434bcb3d9b37e110f47dda3 /build/target.cxx
parent040ebadfa9e606b56005b80571e7fc714a3f1f2c (diff)
Tighten variable_map interface
Diffstat (limited to 'build/target.cxx')
-rw-r--r--build/target.cxx16
1 files changed, 5 insertions, 11 deletions
diff --git a/build/target.cxx b/build/target.cxx
index 37cec8c..aaf8a5e 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -119,18 +119,12 @@ namespace build
value_proxy target::
operator[] (const variable& var) const
{
- auto find = [&var] (const variable_map& vars)
- {
- auto i (vars.find (var));
- return i != vars.end () ? &const_cast<value_ptr&> (i->second) : nullptr;
- };
-
- if (auto p = find (vars))
+ if (auto p = vars.find (var))
return value_proxy (p, &vars);
if (group != nullptr)
{
- if (auto p = find (group->vars))
+ if (auto p = group->vars.find (var))
return value_proxy (p, &group->vars);
}
@@ -141,7 +135,7 @@ namespace build
{
if (!s->target_vars.empty ())
{
- auto find_specific = [&find, s] (const target& t) -> value_proxy
+ auto find_specific = [&var, s] (const target& t) -> value_proxy
{
// Search across target type hierarchy.
//
@@ -159,7 +153,7 @@ namespace build
if (j == i->second.end ())
continue;
- if (auto p = find (j->second))
+ if (auto p = j->second.find (var))
return value_proxy (p, &j->second);
}
@@ -176,7 +170,7 @@ namespace build
}
}
- if (auto p = find (s->vars))
+ if (auto p = s->vars.find (var))
return value_proxy (p, &s->vars);
}