From f519c44792429ce52cfab09898701bff9c202770 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 31 Jan 2017 09:53:25 +0200 Subject: Add load generation to global variable_map values --- build2/variable.ixx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'build2/variable.ixx') 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 inline typename I::reference variable_map::iterator_adapter:: 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 (val), *var.type, &var); + { + // All values shall be typed during load. + // + assert (!m_->global_ || phase == run_phase::load); + m_->typify (const_cast (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 (val), *var.type, &var); + { + // All values shall be typed during load. + // + assert (!m_->global_ || phase == run_phase::load); + m_->typify (const_cast (val), var); + } return p; } -- cgit v1.1