From e879c347f4f05dac5405bcc45ae2d5c9dde5447c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Aug 2016 15:30:39 +0200 Subject: Add support for target visibility, use for dist, test, install This means we can no longer write: install = false Now it should be: *: install = false --- build2/scope.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'build2/scope.cxx') diff --git a/build2/scope.cxx b/build2/scope.cxx index 885a8d2..9cbeca1 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -18,6 +18,8 @@ namespace build2 const target_type* gt, const string* gn, size_t start_d) const { + assert (tt != nullptr || var.visibility != variable_visibility::target); + size_t d (0); // Process target type/pattern-specific prepend/append values. @@ -131,7 +133,10 @@ namespace build2 } } - if (++d >= start_d) + // 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 (const value* v = s->vars.find (var)) return make_pair (lookup (v, &s->vars), d); @@ -142,6 +147,7 @@ namespace build2 case variable_visibility::scope: s = nullptr; break; + case variable_visibility::target: case variable_visibility::project: s = s->root () ? nullptr : s->parent_scope (); break; @@ -230,6 +236,8 @@ namespace build2 } case variable_visibility::normal: break; + case variable_visibility::target: + assert (false); } return true; -- cgit v1.1