From b439803cc5e09188c7b523333f6b71de3ba57dbf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 16 Jul 2016 10:51:35 +0200 Subject: Add support for prepend/append in target type/pattern-specific vars Semantically, these are similar to variable overrides and are essentially treated as "templates" that are applied on lookup to the "stem" value that is specific to the target type/name. For example: x = [string] a file{f*}: x =+ b sub/: { file{*}: x += c print $(file{foo}:x) # abc print $(file{bar}:x) # ac } --- build2/scope | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'build2/scope') diff --git a/build2/scope b/build2/scope index b7c9aef..70eb73d 100644 --- a/build2/scope +++ b/build2/scope @@ -134,13 +134,15 @@ namespace build2 return var.override == nullptr ? p : find_override (var, move (p)); } - // Implementation details (used by scope target lookup). + // Implementation details (used by scope target lookup). The start_depth + // can be used to skip a number of initial lookups. // pair find_original ( const variable&, const target_type* tt = nullptr, const string* tn = nullptr, - const target_type* gt = nullptr, const string* gn = nullptr) const; + const target_type* gt = nullptr, const string* gn = nullptr, + size_t start_depth = 1) const; pair find_override (const variable&, -- cgit v1.1