diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-16 08:57:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-17 07:47:17 +0200 |
commit | 962f83b1e551cc683f1052d32cb79b969e65af5f (patch) | |
tree | 8e3d1936db8be9b07baffac289bb3b4e06010cf8 /libbuild2/test/script | |
parent | 9f71deeeb0f8e6fe2c29f209fc96f466fc2831b6 (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/test/script')
-rw-r--r-- | libbuild2/test/script/parser.cxx | 4 | ||||
-rw-r--r-- | libbuild2/test/script/script.cxx | 30 | ||||
-rw-r--r-- | libbuild2/test/script/script.hxx | 10 |
3 files changed, 23 insertions, 21 deletions
diff --git a/libbuild2/test/script/parser.cxx b/libbuild2/test/script/parser.cxx index 4a5a64a..06cefc7 100644 --- a/libbuild2/test/script/parser.cxx +++ b/libbuild2/test/script/parser.cxx @@ -3377,8 +3377,8 @@ namespace build2 } return pvar != nullptr - ? scope_->find (*pvar) - : script_->find_in_buildfile (name); + ? scope_->lookup (*pvar) + : script_->lookup_in_buildfile (name); } size_t parser:: diff --git a/libbuild2/test/script/script.cxx b/libbuild2/test/script/script.cxx index d8cf5fb..79b8bca 100644 --- a/libbuild2/test/script/script.cxx +++ b/libbuild2/test/script/script.cxx @@ -533,7 +533,7 @@ namespace build2 // Note that the test variable's visibility is target. // - lookup l (find_in_buildfile ("test", false)); + auto l (lookup_in_buildfile ("test", false)); // Note that we have similar code for simple tests. // @@ -608,7 +608,7 @@ namespace build2 } lookup scope:: - find (const variable& var) const + lookup (const variable& var) const { // Search script scopes until we hit the root. // @@ -616,18 +616,18 @@ namespace build2 do { - auto p (s->vars.find (var)); + auto p (s->vars.lookup (var)); if (p.first != nullptr) - return lookup (*p.first, p.second, s->vars); + return lookup_type (*p.first, p.second, s->vars); } while ((s->parent != nullptr ? (s = s->parent) : nullptr) != nullptr); - return find_in_buildfile (var.name); + return lookup_in_buildfile (var.name); } lookup scope:: - find_in_buildfile (const string& n, bool target_only) const + lookup_in_buildfile (const string& n, bool target_only) const { // Switch to the corresponding buildfile variable. Note that we don't // want to insert a new variable into the pool (we might be running @@ -637,7 +637,7 @@ namespace build2 const variable* pvar (root.test_target.ctx.var_pool.find (n)); if (pvar == nullptr) - return lookup (); + return lookup_type (); const variable& var (*pvar); @@ -648,12 +648,12 @@ namespace build2 // value. In this case, presumably the override also affects the // script target and we will pick it up there. A bit fuzzy. // - auto p (root.test_target.find_original (var, target_only)); + auto p (root.test_target.lookup_original (var, target_only)); if (p.first) { if (var.overrides != nullptr) - p = root.target_scope.find_override (var, move (p), true); + p = root.target_scope.lookup_override (var, move (p), true); return p.first; } @@ -670,7 +670,7 @@ namespace build2 value& scope:: append (const variable& var) { - lookup l (find (var)); + auto l (lookup (var)); if (l.defined () && l.belongs (*this)) // Existing var in this scope. return vars.modify (l); @@ -695,23 +695,23 @@ namespace build2 s.insert (s.end (), v.begin (), v.end ()); }; - if (lookup l = find (root.test_var)) + if (auto l = lookup (root.test_var)) s.push_back (cast<path> (l).representation ()); - if (lookup l = find (root.options_var)) + if (auto l = lookup (root.options_var)) append (cast<strings> (l)); - if (lookup l = find (root.arguments_var)) + if (auto l = lookup (root.arguments_var)) append (cast<strings> (l)); // Keep redirects/cleanups out of $N. // size_t n (s.size ()); - if (lookup l = find (root.redirects_var)) + if (auto l = lookup (root.redirects_var)) append (cast<strings> (l)); - if (lookup l = find (root.cleanups_var)) + if (auto l = lookup (root.cleanups_var)) append (cast<strings> (l)); // Set the $N values if present. diff --git a/libbuild2/test/script/script.hxx b/libbuild2/test/script/script.hxx index 8e5df16..a28ef25 100644 --- a/libbuild2/test/script/script.hxx +++ b/libbuild2/test/script/script.hxx @@ -369,15 +369,17 @@ namespace build2 // and then outer buildfile scopes (including testscript-type/pattern // specific). // - lookup - find (const variable&) const; + using lookup_type = build2::lookup; + + lookup_type + lookup (const variable&) const; // As above but only look for buildfile variables. If target_only is // false then also look in scopes of the test target (this should only // be done if the variable's visibility is target). // - lookup - find_in_buildfile (const string&, bool target_only = true) const; + lookup_type + lookup_in_buildfile (const string&, bool target_only = true) const; // Return a value suitable for assignment. If the variable does not // exist in this scope's map, then a new one with the NULL value is |