aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-31 09:01:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-31 09:01:50 +0200
commit6417a4e6af2b7732ec0da6af24f1a56f7cdada3f (patch)
tree58ffae7ef0cdac55acd6d498dfc66ce0967f4e9a /build2/variable.ixx
parent31bd69c56bc29ec1c154a7c0623b6f0ccce78af1 (diff)
Set part of variable override implementation
Diffstat (limited to 'build2/variable.ixx')
-rw-r--r--build2/variable.ixx35
1 files changed, 6 insertions, 29 deletions
diff --git a/build2/variable.ixx b/build2/variable.ixx
index 67f8c56..a4d7dc3 100644
--- a/build2/variable.ixx
+++ b/build2/variable.ixx
@@ -552,37 +552,14 @@ namespace build2
return !p->empty ();
}
+ // variable_pool
+ //
inline const variable& variable_pool::
- find (string n, const variable_visibility* vv, const build2::value_type* t)
+ find (const string& n)
{
- auto r (
- insert (
- variable {
- move (n),
- t,
- vv != nullptr ? *vv : variable_visibility::normal}));
- const variable& v (*r.first);
-
- // Update type?
- //
- if (!r.second && t != nullptr && v.type != t)
- {
- assert (v.type == nullptr);
- const_cast<variable&> (v).type = t; // Not changing the key.
- }
-
- // Change visibility? While this might at first seem like a bad idea,
- // it can happen that the variable lookup happens before any values
- // were set, in which case the variable will be entered with the
- // default visibility.
- //
- if (!r.second && vv != nullptr && v.visibility != *vv)
- {
- assert (v.visibility == variable_visibility::normal); // Default.
- const_cast<variable&> (v).visibility = *vv; // Not changing the key.
- }
-
- return v;
+ auto p (variable_pool_base::insert (
+ variable {n, nullptr, nullptr, variable_visibility::normal}));
+ return *p.first;
}
// variable_map::iterator_adapter