aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.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/scope.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/scope.hxx')
-rw-r--r--libbuild2/scope.hxx50
1 files changed, 26 insertions, 24 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 006d1a7..97ec448 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -95,64 +95,66 @@ namespace build2
// scope, do it on the the variables 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 include target type/pattern-specific variables.
//
- lookup
- find (const variable& var, const target_key& tk) const
+ lookup_type
+ lookup (const variable& var, const target_key& tk) const
{
- return find (var, tk.type, tk.name).first;
+ return lookup (var, tk.type, tk.name).first;
}
- lookup
- find (const variable& var, const target_type& tt, const string& tn) const
+ lookup_type
+ lookup (const variable& var, const target_type& tt, const string& tn) const
{
- return find (var, &tt, &tn).first;
+ return lookup (var, &tt, &tn).first;
}
- pair<lookup, size_t>
- find (const variable& var,
- const target_type* tt = nullptr,
- const string* tn = nullptr) const
+ pair<lookup_type, size_t>
+ lookup (const variable& var,
+ const target_type* tt = nullptr,
+ const string* tn = nullptr) const
{
- auto p (find_original (var, tt, tn));
- return var.overrides == nullptr ? p : find_override (var, move (p));
+ auto p (lookup_original (var, tt, tn));
+ return var.overrides == nullptr ? p : lookup_override (var, move (p));
}
// Implementation details (used by scope target lookup). The start_depth
// can be used to skip a number of initial lookups.
//
- pair<lookup, size_t>
- find_original (
+ pair<lookup_type, size_t>
+ lookup_original (
const variable&,
const target_type* tt = nullptr, const string* tn = nullptr,
const target_type* gt = nullptr, const string* gn = nullptr,
size_t start_depth = 1) const;
- pair<lookup, size_t>
- find_override (const variable&,
- pair<lookup, size_t> original,
- bool target = false,
- bool rule = false) const;
+ pair<lookup_type, size_t>
+ lookup_override (const variable&,
+ pair<lookup_type, size_t> original,
+ bool target = false,
+ bool rule = false) const;
// Return a value suitable for assignment (or append if you only want to
// append to the value from this scope). If the value does not exist in