From 19af3f6b0873a92582e4787a87a6f14df53ff6ae Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 10 Oct 2022 18:22:31 +0200 Subject: Preparatory work for public/private variable distinction We still always use the public var_pool from context but where required, all access now goes through scope::var_pool(). --- libbuild2/file.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libbuild2/file.cxx') diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index 3374791..a2fe906 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -582,12 +582,16 @@ namespace build2 fail << "variable out_root expected as first line in " << f << endf; } - static void + // Note: not static due to being a friend of variable_pool. + // + void setup_root_extra (scope& root, optional& altn) { assert (altn && root.root_extra == nullptr); bool a (*altn); + context& ctx (root.ctx); + root.root_extra.reset ( new scope::root_extra_type { nullopt /* project */, @@ -607,6 +611,7 @@ namespace build2 a ? alt_export_file : std_export_file, a ? alt_src_root_file : std_src_root_file, a ? alt_out_root_file : std_out_root_file, + {&ctx, &ctx.var_pool.rw (root)}, /* var_pool */ {}, /* meta_operations */ {}, /* operations */ {}, /* modules */ @@ -3197,13 +3202,15 @@ namespace build2 const string& pfx (ns[1].value); - auto& vp (ctx.var_pool.rw ()); // Load phase. - // See if we have the stable program name in the .name // variable. If its missing, set it to the metadata key (i.e., target // name as imported) by default. // { + // Note: go straight for the public variable pool. + // + auto& vp (ctx.var_pool.rw ()); // Load phase. + value& nv (t.assign (vp.insert (pfx + ".name"))); if (!nv) nv = *meta; -- cgit v1.1