diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-07-31 09:34:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-07-31 09:34:05 +0200 |
commit | b13b031b2b8a7390d1dd4b2658d0f0b62e43db47 (patch) | |
tree | f4d2d12c6717541ec7d2b56cfafa25ebd73070d9 /libbuild2/target.cxx | |
parent | e122c6ff4a7f21026332ce9211ad095bd44e71ea (diff) |
Add lookup limit to {scope,target}::lookup_original()
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r-- | libbuild2/target.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index 1a72788..65e18d3 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -142,7 +142,7 @@ namespace build2 pair<lookup, size_t> target:: lookup_original (const variable& var, - bool target_only, + lookup_limit limit, const scope* bs, bool locked) const { @@ -204,7 +204,7 @@ namespace build2 // if (!r.first) { - if (!target_only) + if (limit != lookup_limit::target) { auto key = [locked] (const target* t) { @@ -221,7 +221,8 @@ namespace build2 auto p (bs->lookup_original (var, &tk, g1 != nullptr ? &g1k : nullptr, - g2 != nullptr ? &g2k : nullptr)); + g2 != nullptr ? &g2k : nullptr, + limit)); r.first = move (p.first); r.second = r.first ? r.second + p.second : p.second; @@ -241,7 +242,7 @@ namespace build2 // Note that here we want the original value without any overrides // applied. // - auto l (lookup_original (var, false, bs).first); + auto l (lookup_original (var, bs).first); if (l.defined () && l.belongs (*this)) // Existing var in this target. return vars.modify (l); // Ok since this is original. @@ -257,7 +258,7 @@ namespace build2 value& target:: append_locked (const variable& var, const scope* bs) { - auto l (lookup_original (var, false, bs, true /* locked */).first); + auto l (lookup_original (var, bs, true /* locked */).first); if (l.defined () && l.belongs (*this)) // Existing var in this target. return vars.modify (l); // Ok since this is original. @@ -271,7 +272,7 @@ namespace build2 } pair<lookup, size_t> target::opstate:: - lookup_original (const variable& var, bool target_only) const + lookup_original (const variable& var, lookup_limit limit) const { pair<lookup_type, size_t> r (lookup_type (), 0); @@ -286,7 +287,7 @@ namespace build2 // if (!r.first) { - auto p (target_->lookup_original (var, target_only)); + auto p (target_->lookup_original (var, limit)); r.first = move (p.first); r.second = r.first ? r.second + p.second : p.second; |