aboutsummaryrefslogtreecommitdiff
path: root/build2/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-04 13:06:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-04 13:06:50 +0200
commit5c369faa461ec4416d2d4b231a5b36963a7315ce (patch)
treefc1b550870a29f0a03e258a76f16496ac69ec35c /build2/target
parent0e486cd3642da8a442629ffce9a3daf16745c35e (diff)
Implement value typing, null support via value attributes
For example: v = [null] v = [string] abc v += ABC # abcABC
Diffstat (limited to 'build2/target')
-rw-r--r--build2/target15
1 files changed, 11 insertions, 4 deletions
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<lookup, size_t>
- 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<lookup, size_t>
find (const string& name) const {return find (var_pool.find (name));}
+ pair<lookup, size_t>
+ 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;}