diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-04 13:06:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-04 13:06:50 +0200 |
commit | 5c369faa461ec4416d2d4b231a5b36963a7315ce (patch) | |
tree | fc1b550870a29f0a03e258a76f16496ac69ec35c /build2/scope.cxx | |
parent | 0e486cd3642da8a442629ffce9a3daf16745c35e (diff) |
Implement value typing, null support via value attributes
For example:
v = [null]
v = [string] abc
v += ABC # abcABC
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r-- | build2/scope.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx index b0bd109..b74d52a 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -307,15 +307,18 @@ namespace build2 value& scope:: append (const variable& var) { - auto l (operator[] (var)); + // Note that here we want the original value without any overrides + // applied. + // + lookup l (find_original (var).first); - if (l && l.belongs (*this)) // Existing variable in this scope. - return const_cast<value&> (*l); + if (l.defined () && l.belongs (*this)) // Existing var in this scope. + return const_cast<value&> (*l); // Ok since this is original. - value& r (assign (var)); + value& r (assign (var)); // NULL. - if (l) - r = *l; // Copy value from the outer scope. + if (l.defined ()) + r = *l; // Copy value (and type) from the outer scope. return r; } |