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/variable.txx | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'build2/variable.txx') diff --git a/build2/variable.txx b/build2/variable.txx index a3511d4..a86a936 100644 --- a/build2/variable.txx +++ b/build2/variable.txx @@ -54,13 +54,15 @@ namespace build2 catch (const invalid_argument&) {} // Fall through. } - diag_record dr (error); + { + diag_record dr (error); - dr << "invalid " << value_traits::value_type.name - << " value '" << ns << "'"; + dr << "invalid " << value_traits::value_type.name + << " value '" << ns << "'"; - if (var != nullptr) - dr << " in variable " << var->name; + if (var != nullptr) + dr << " in variable " << var->name; + } throw failed (); } @@ -84,13 +86,15 @@ namespace build2 catch (const invalid_argument&) {} // Fall through. } - diag_record dr (error); + { + diag_record dr (error); - dr << "invalid " << value_traits::value_type.name - << " value '" << ns << "'"; + dr << "invalid " << value_traits::value_type.name + << " value '" << ns << "'"; - if (var != nullptr) - dr << " in variable " << var->name; + if (var != nullptr) + dr << " in variable " << var->name; + } throw failed (); } @@ -114,13 +118,15 @@ namespace build2 catch (const invalid_argument&) {} // Fall through. } - diag_record dr (error); + { + diag_record dr (error); - dr << "invalid " << value_traits::value_type.name - << " value '" << ns << "'"; + dr << "invalid " << value_traits::value_type.name + << " value '" << ns << "'"; - if (var != nullptr) - dr << " in variable " << var->name; + if (var != nullptr) + dr << " in variable " << var->name; + } throw failed (); } -- cgit v1.1