diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-09 11:38:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-09 11:38:42 +0200 |
commit | 5f7c3f923de106f9d204a8f3500274731ae84fd9 (patch) | |
tree | a4993277c75e61b73bb6f984e2ad0c329a514f9a /build2/scope | |
parent | 7a7b8ba432977282a90567c77822a72645d2a5c8 (diff) |
Tweak override logic WRT location of overridden value
Diffstat (limited to 'build2/scope')
-rw-r--r-- | build2/scope | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build2/scope b/build2/scope index 566466a..09914a9 100644 --- a/build2/scope +++ b/build2/scope @@ -92,7 +92,7 @@ namespace build2 lookup operator[] (const variable& var) const { - return find (var, nullptr, nullptr); + return find (var).first; } lookup @@ -106,7 +106,7 @@ namespace build2 lookup find (const variable& var, const target_key& tk) const { - return find (var, tk.type, tk.name); + return find (var, tk.type, tk.name).first; } lookup @@ -118,7 +118,7 @@ namespace build2 lookup find (const variable& var, const target_type& tt, const string& tn) const { - return find (var, &tt, &tn); + return find (var, &tt, &tn).first; } lookup @@ -127,13 +127,13 @@ namespace build2 return find (var_pool.find (var), tt, tn); } - lookup - find (const variable& var, const target_type* tt, const string* tn) const + pair<lookup, size_t> + find (const variable& var, + const target_type* tt = nullptr, + const string* tn = nullptr) const { auto p (find_original (var, tt, tn)); - return var.override == nullptr - ? p.first - : find_override (var, move (p), false).first; + return var.override == nullptr ? p : find_override (var, move (p)); } // Implementation details (used by scope target lookup). @@ -147,7 +147,7 @@ namespace build2 pair<lookup, size_t> find_override (const variable&, pair<lookup, size_t>&& original, - bool target) const; + bool target = false) const; // Return a value suitable for assignment (or append if you only // want to append to the value from this scope). If the variable |