From 962f83b1e551cc683f1052d32cb79b969e65af5f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 16 Mar 2020 08:57:29 +0200 Subject: 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. --- libbuild2/target.hxx | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'libbuild2/target.hxx') 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 - find (const variable& var) const + pair + 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 - find_original (const variable&, bool target_only = false) const; + pair + 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 - find (const variable& var) const + pair + 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 - find_original (const variable&, bool target_only = false) const; + pair + lookup_original (const variable&, bool target_only = false) const; // Return a value suitable for assignment. See target for details. // -- cgit v1.1