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/scope.hxx | |
parent | e122c6ff4a7f21026332ce9211ad095bd44e71ea (diff) |
Add lookup limit to {scope,target}::lookup_original()
Diffstat (limited to 'libbuild2/scope.hxx')
-rw-r--r-- | libbuild2/scope.hxx | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index f821411..ece78b7 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -186,37 +186,25 @@ namespace build2 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. + // Implementation details (used by scope and target lookup). + // + // The only valid values for limit are none and target_type and in the + // latter case the target key should not be NULL. If it is target_type, + // then only look in target type/pattern-specific variables. Note that if + // a target type/pattern-specific append/prepend modifies a scope + // variable, then the resulting value is considered target type/pattern- + // specific. + // + // The start_depth can be used to skip a number of initial lookups. // pair<lookup_type, size_t> lookup_original (const variable& var, const target_key* tk = nullptr, const target_key* g1k = nullptr, const target_key* g2k = nullptr, - size_t start_depth = 1) const - { - return lookup_original_info (var, tk, g1k, g2k, start_depth).lookup; - } - - // As above but also return an indication of whether the resulting value - // was modified by a target type/pattern-specific append/prepend. - // - struct original_info - { - pair<lookup_type, size_t> lookup; - bool modified; - }; - - original_info - lookup_original_info (const variable&, - const target_key* tk, - const target_key* g1k = nullptr, - const target_key* g2k = nullptr, - size_t start_depth = 1) const; + lookup_limit limit = lookup_limit::none, + size_t start_depth = 1) const; - // Implementation details (used by scope target lookup). - // pair<lookup_type, size_t> lookup_override (const variable& var, pair<lookup_type, size_t> original, |