diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-03-07 13:53:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-03-07 13:58:48 +0200 |
commit | c6a4d07f79c8167c86f4d64669c689852efcbd4c (patch) | |
tree | 2b5df5564e8d73a9413d3710e307915967f9c0af /libbuild2/target.cxx | |
parent | 8475c82a2ca186f4ca987e50b4249bb8eb32ba01 (diff) |
Fix operation-specific variables logic for inner/outer operations
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r-- | libbuild2/target.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index f829cca..7ab0abd 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -564,17 +564,23 @@ namespace build2 << "'" << *v << "' specified for prerequisite " << p; } - // Handle operation-specific override. + // Handle operation-specific override (see var_include documentation + // for details). // lookup l; optional<bool> r1; // Absent means something other than true|false. names storage; names_view ns; + const variable* current_ovar (nullptr); - if (r != include_type::excluded && ctx.current_ovar != nullptr) + if (r != include_type::excluded) { - if ((l = p.vars[*ctx.current_ovar])) + current_ovar = a.outer () + ? ctx.current_outer_ovar + : ctx.current_inner_ovar; + + if (current_ovar != nullptr && (l = p.vars[*current_ovar])) { // Maybe we should optimize this for the common cases (bool, path, // name)? But then again we don't expect many such overrides. Plus @@ -619,7 +625,7 @@ namespace build2 // Note: we have to delay this until the meta-operation callback above // had a chance to override it. // - fail << "unrecognized " << *ctx.current_ovar << " variable value " + fail << "unrecognized " << *current_ovar << " variable value " << "'" << ns << "' specified for prerequisite " << p; } } |