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/context.cxx | |
parent | 8475c82a2ca186f4ca987e50b4249bb8eb32ba01 (diff) |
Fix operation-specific variables logic for inner/outer operations
Diffstat (limited to 'libbuild2/context.cxx')
-rw-r--r-- | libbuild2/context.cxx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx index d0b24e0..a052481 100644 --- a/libbuild2/context.cxx +++ b/libbuild2/context.cxx @@ -706,18 +706,28 @@ namespace build2 current_mode = inner_oif.mode; current_diag_noise = diag_noise; - if (oif.var_name != nullptr) + auto find_ovar = [this] (const char* n) { - current_ovar = var_pool.find (oif.var_name); + const variable* v (var_pool.find (n)); // The operation variable should have prerequisite or target visibility. // - assert (current_ovar != nullptr && - (current_ovar->visibility == variable_visibility::prereq || - current_ovar->visibility == variable_visibility::target)); - } - else - current_ovar = nullptr; + assert (v != nullptr && + (v->visibility == variable_visibility::prereq || + v->visibility == variable_visibility::target)); + + return v; + }; + + current_inner_ovar = + inner_oif.var_name != nullptr + ? find_ovar (inner_oif.var_name) + : nullptr; + + current_outer_ovar = + outer_oif != nullptr && outer_oif->var_name != nullptr + ? find_ovar (outer_oif->var_name) + : nullptr; // Reset counters (serial execution). // |