aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-31 09:53:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commitf519c44792429ce52cfab09898701bff9c202770 (patch)
tree436ad143530ba0b7bd6b69b39fe1bb9f1e389751 /build2/variable.ixx
parent450c5c09ed7898a800bf5c9328799a43aba78e48 (diff)
Add load generation to global variable_map values
Diffstat (limited to 'build2/variable.ixx')
-rw-r--r--build2/variable.ixx20
1 files changed, 16 insertions, 4 deletions
diff --git a/build2/variable.ixx b/build2/variable.ixx
index 816f4bf..8d5d710 100644
--- a/build2/variable.ixx
+++ b/build2/variable.ixx
@@ -639,18 +639,25 @@ namespace build2
// variable_map::iterator_adapter
//
+ extern run_phase phase; // context
+
template <typename I>
inline typename I::reference variable_map::iterator_adapter<I>::
operator* () const
{
auto& r (I::operator* ());
const variable& var (r.first);
- auto& val (r.second);
+ const value_data& val (r.second);
// First access after being assigned a type?
//
if (var.type != nullptr && val.type != var.type)
- typify (const_cast<value&> (val), *var.type, &var);
+ {
+ // All values shall be typed during load.
+ //
+ assert (!m_->global_ || phase == run_phase::load);
+ m_->typify (const_cast<value_data&> (val), var);
+ }
return r;
}
@@ -661,12 +668,17 @@ namespace build2
{
auto p (I::operator-> ());
const variable& var (p->first);
- auto& val (p->second);
+ const value_data& val (p->second);
// First access after being assigned a type?
//
if (var.type != nullptr && val.type != var.type)
- typify (const_cast<value&> (val), *var.type, &var);
+ {
+ // All values shall be typed during load.
+ //
+ assert (!m_->global_ || phase == run_phase::load);
+ m_->typify (const_cast<value_data&> (val), var);
+ }
return p;
}