aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-12 08:31:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-13 06:49:26 +0200
commit3ba17db6300d7e0cfc4fa001b5a8eb91bf417ea3 (patch)
tree2c0878097ba9b049ea472c2c8c99a0e4ff77e959 /libbuild2/target.cxx
parentd66e21ffa3ac9520fb15dd3859339b178d6e6540 (diff)
Switch to public/private variables model
Now unqualified variables are project-private and can be typified.
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r--libbuild2/target.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 14b6496..a466951 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -582,15 +582,22 @@ namespace build2
names storage;
names_view ns;
- const variable* current_ovar (nullptr);
+ const variable* ovar (nullptr);
if (r != include_type::excluded)
{
- current_ovar = a.outer ()
- ? ctx.current_outer_ovar
- : ctx.current_inner_ovar;
+ // Instead of going via potentially expensive target::base_scope(), use
+ // the prerequisite's scope; while it may not be the same as the
+ // targets's base scope, they must have the same root scope.
+ //
+ const scope& rs (*p.scope.root_scope ());
+
+ ovar = rs.root_extra->operations[
+ (a.outer ()
+ ? ctx.current_outer_oif
+ : ctx.current_inner_oif)->id].ovar;
- if (current_ovar != nullptr && (l = p.vars[*current_ovar]))
+ if (ovar != nullptr && (l = p.vars[*ovar]))
{
// Maybe we should optimize this for the common cases (bool, path,
// name)? But then again we don't expect many such overrides. Plus
@@ -635,7 +642,7 @@ namespace build2
// Note: we have to delay this until the meta-operation callback above
// had a chance to override it.
//
- fail << "unrecognized " << *current_ovar << " variable value "
+ fail << "unrecognized " << *ovar << " variable value "
<< "'" << ns << "' specified for prerequisite " << p;
}
}