aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-10 18:22:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-10 18:22:31 +0200
commit19af3f6b0873a92582e4787a87a6f14df53ff6ae (patch)
tree7545e80d9348eb7808e1c894cd111ab46cc8a9a5 /libbuild2/file.cxx
parent9f95a23eae04680559a9cb943fdfaa00f52cd66e (diff)
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().
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx13
1 files changed, 10 insertions, 3 deletions
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<bool>& 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 <var-prefix>.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;