aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-03-16 08:57:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-03-17 07:47:17 +0200
commit962f83b1e551cc683f1052d32cb79b969e65af5f (patch)
tree8e3d1936db8be9b07baffac289bb3b4e06010cf8 /libbuild2/target.hxx
parent9f71deeeb0f8e6fe2c29f209fc96f466fc2831b6 (diff)
Rename all find*(variable) to lookup*(variable)
Now we consistently use term "lookup" for variable value lookup. At some point we should also rename type lookup to binding and get rid of all the lookup_type aliases.
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx48
1 files changed, 26 insertions, 22 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 4d6cc1a..1abda2d 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -393,24 +393,26 @@ namespace build2
// only want to lookup in this target, do it on the variable map directly
// (and note that there will be no overrides).
//
- lookup
+ using lookup_type = build2::lookup;
+
+ lookup_type
operator[] (const variable& var) const
{
- return find (var).first;
+ return lookup (var).first;
}
- lookup
+ lookup_type
operator[] (const variable* var) const // For cached variables.
{
assert (var != nullptr);
return operator[] (*var);
}
- lookup
+ lookup_type
operator[] (const string& name) const
{
const variable* var (ctx.var_pool.find (name));
- return var != nullptr ? operator[] (*var) : lookup ();
+ return var != nullptr ? operator[] (*var) : lookup_type ();
}
// As above but also return the depth at which the value is found. The
@@ -421,20 +423,20 @@ namespace build2
// that given two lookups from the same target, we can say which one came
// earlier. If no value is found, then the depth is set to ~0.
//
- pair<lookup, size_t>
- find (const variable& var) const
+ pair<lookup_type, size_t>
+ lookup (const variable& var) const
{
- auto p (find_original (var));
+ auto p (lookup_original (var));
return var.overrides == nullptr
? p
- : base_scope ().find_override (var, move (p), true);
+ : base_scope ().lookup_override (var, move (p), true);
}
// If target_only is true, then only look in target and its target group
// without continuing in scopes.
//
- pair<lookup, size_t>
- find_original (const variable&, bool target_only = false) const;
+ pair<lookup_type, size_t>
+ lookup_original (const variable&, bool target_only = false) const;
// Return a value suitable for assignment. See scope for details.
//
@@ -525,24 +527,26 @@ namespace build2
// want to lookup in this target, do it on the variable map directly
// (and note that there will be no overrides).
//
- lookup
+ using lookup_type = build2::lookup;
+
+ lookup_type
operator[] (const variable& var) const
{
- return find (var).first;
+ return lookup (var).first;
}
- lookup
+ lookup_type
operator[] (const variable* var) const // For cached variables.
{
assert (var != nullptr);
return operator[] (*var);
}
- lookup
+ lookup_type
operator[] (const string& name) const
{
const variable* var (target_->ctx.var_pool.find (name));
- return var != nullptr ? operator[] (*var) : lookup ();
+ return var != nullptr ? operator[] (*var) : lookup_type ();
}
// As above but also return the depth at which the value is found. The
@@ -550,20 +554,20 @@ namespace build2
// that is from the rule will have depth 1. That from the target - 2,
// and so on, similar to target-specific variables.
//
- pair<lookup, size_t>
- find (const variable& var) const
+ pair<lookup_type, size_t>
+ lookup (const variable& var) const
{
- auto p (find_original (var));
+ auto p (lookup_original (var));
return var.overrides == nullptr
? p
- : target_->base_scope ().find_override (var, move (p), true, true);
+ : target_->base_scope ().lookup_override (var, move (p), true, true);
}
// If target_only is true, then only look in target and its target group
// without continuing in scopes.
//
- pair<lookup, size_t>
- find_original (const variable&, bool target_only = false) const;
+ pair<lookup_type, size_t>
+ lookup_original (const variable&, bool target_only = false) const;
// Return a value suitable for assignment. See target for details.
//