From 5c369faa461ec4416d2d4b231a5b36963a7315ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 4 Apr 2016 13:06:50 +0200 Subject: Implement value typing, null support via value attributes For example: v = [null] v = [string] abc v += ABC # abcABC --- build2/target | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'build2/target') diff --git a/build2/target b/build2/target index eb6154a..241f6ff 100644 --- a/build2/target +++ b/build2/target @@ -288,7 +288,7 @@ namespace build2 } // As above but also return the depth at which the value is found. The - // depth is calculated by adding 1 for each test performed. So a value + // depth is calculated by adding 1 for each test performed. So a value // that is from the target will have depth 1. That from the group -- 2. // From the innermost scope's target type/patter-specific variables -- // 3. From the innermost scope's variables -- 4. And so on. The idea is @@ -296,14 +296,21 @@ namespace build2 // earlier. If no value is found, then the depth is set to ~0. // pair - find (const variable&) const; + find (const variable& var) const + { + auto p (find_original (var)); + return var.override == nullptr + ? p + : base_scope ().find_override (var, move (p), true); + } pair find (const string& name) const {return find (var_pool.find (name));} + pair + find_original (const variable&) const; - // Return a value suitable for assignment. See class scope for - // details. + // Return a value suitable for assignment. See scope for details. // value& assign (const variable& var) {return vars.assign (var).first;} -- cgit v1.1