aboutsummaryrefslogtreecommitdiff
path: root/build2/scope.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-31 10:59:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-31 10:59:45 +0200
commit7253ffee27f6cae34e63a72b2d3d10db10571ecc (patch)
treec86b321ad4d2bcb05eda451ad3cae5ac8429cabf /build2/scope.cxx
parent6417a4e6af2b7732ec0da6af24f1a56f7cdada3f (diff)
Clean up variable lookup interfaces
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r--build2/scope.cxx27
1 files changed, 18 insertions, 9 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx
index 294833e..77efccd 100644
--- a/build2/scope.cxx
+++ b/build2/scope.cxx
@@ -12,21 +12,30 @@ namespace build2
{
// scope
//
- lookup<const value> scope::
- lookup (const target_type* tt, const string* name, const variable& var) const
+ lookup scope::
+ find (const variable& var,
+ const target_type* tt, const string* tn,
+ const target_type* gt, const string* gn) const
{
- using result = build2::lookup<const value>;
-
for (const scope* s (this); s != nullptr; )
{
- if (tt != nullptr && !s->target_vars.empty ())
+ if (!s->target_vars.empty ())
{
- if (auto l = s->target_vars.lookup (*tt, *name, var))
- return l;
+ if (tt != nullptr)
+ {
+ if (auto l = s->target_vars.find (*tt, *tn, var))
+ return l;
+ }
+
+ if (gt != nullptr)
+ {
+ if (auto l = s->target_vars.find (*gt, *gn, var))
+ return l;
+ }
}
if (auto r = s->vars.find (var))
- return result (r, &s->vars);
+ return lookup (r, &s->vars);
switch (var.visibility)
{
@@ -42,7 +51,7 @@ namespace build2
}
}
- return result ();
+ return lookup ();
}
value& scope::