diff options
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; } |