diff options
Diffstat (limited to 'libbuild2/scope.cxx')
-rw-r--r-- | libbuild2/scope.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libbuild2/scope.cxx b/libbuild2/scope.cxx index 23781a8..8710a3d 100644 --- a/libbuild2/scope.cxx +++ b/libbuild2/scope.cxx @@ -48,10 +48,13 @@ namespace build2 const target_key* tk, const target_key* g1k, const target_key* g2k, + lookup_limit limit, size_t start_d) const { - assert (tk != nullptr || var.visibility != variable_visibility::target); - assert (g2k == nullptr || g1k != nullptr); + assert ((tk != nullptr || var.visibility != variable_visibility::target) && + (g2k == nullptr || g1k != nullptr) && + (limit == lookup_limit::none || + (limit == lookup_limit::target_type || tk != nullptr))); size_t d (0); @@ -79,7 +82,9 @@ namespace build2 // group, then we shouldn't be looking for stem in the target's // variables. In other words, once we "jump" to group, we stay there. // - lookup_type stem (s->lookup_original (var, tk, g1k, g2k, 2).first); + lookup_type stem ( + s->lookup_original ( + var, tk, g1k, g2k, lookup_limit::none, 2).first); // Check the cache. // @@ -115,7 +120,7 @@ namespace build2 cv = *stem; // Typify the cache value in case there is no stem (we still want to - // prepend/append things in type-aware way). + // prepend/append things in a type-aware way). // if (cv.type == nullptr && var.type != nullptr) typify (cv, *var.type, &var); @@ -152,7 +157,7 @@ namespace build2 { bool f (!s->target_vars.empty ()); - // Target. + // Target type/pattern-specific for the target. // if (++d >= start_d) { @@ -170,7 +175,7 @@ namespace build2 } } - // Group. + // Target type/pattern-specific for the group. // if (++d >= start_d) { @@ -205,7 +210,9 @@ namespace build2 // Note that we still increment the lookup depth so that we can compare // depths of variables with different visibilities. // - if (++d >= start_d && var.visibility != variable_visibility::target) + if (++d >= start_d && + limit != lookup_limit::target_type && + var.visibility != variable_visibility::target) { auto p (s->vars.lookup (var)); if (p.first != nullptr) @@ -232,11 +239,11 @@ namespace build2 return make_pair (lookup_type (), size_t (~0)); } - auto scope:: + scope::override_info scope:: lookup_override_info (const variable& var, const pair<lookup_type, size_t> original, bool target, - bool rule) const -> override_info + bool rule) const { assert (!rule || target); // Rule-specific is target-specific. |