aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/variable.ixx')
-rw-r--r--libbuild2/variable.ixx15
1 files changed, 14 insertions, 1 deletions
diff --git a/libbuild2/variable.ixx b/libbuild2/variable.ixx
index a84c012..7cafd89 100644
--- a/libbuild2/variable.ixx
+++ b/libbuild2/variable.ixx
@@ -916,8 +916,21 @@ namespace build2
inline const variable* variable_pool::
find (const string& n) const
{
+ // The pool chaining semantics for lookup: first check own pool then, if
+ // not found, check the outer pool.
+ //
auto i (map_.find (&n));
- return i != map_.end () ? &i->second : nullptr;
+ if (i != map_.end ())
+ return &i->second;
+
+ if (outer_ != nullptr)
+ {
+ i = outer_->map_.find (&n);
+ if (i != outer_->map_.end ())
+ return &i->second;
+ }
+
+ return nullptr;
}
// variable_map