aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-02 15:34:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-02 15:38:09 +0200
commit649d388ff422a9a049e2b50768db357a73ee59d5 (patch)
tree96d7acb53c56cf589d611f41aa15edd7a3cca4a0 /libbuild2/file.cxx
parentaf55babfc0c01abbd0a074b0d2ed86598d6bf628 (diff)
Fail if scope or target qualification in variable expansion is unknown
There are three options here: we can "fall through" to an outer scope (there is always the global scope backstop; this is the old semantics, sort of), we can return NULL straight away, or we can fail. It feels like in most cases unknown scope or target is a mistake and doing anything other than failing is just making things harder to debug.
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index b93a20a..03dea5f 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -523,10 +523,14 @@ namespace build2
pair<scope&, scope*>
switch_scope (scope& root, const dir_path& out_base, bool proj)
{
+ context& ctx (root.ctx);
+
+ assert (ctx.phase == run_phase::load);
+
// First, enter the scope into the map and see if it is in any project. If
// it is not, then there is nothing else to do.
//
- auto i (root.ctx.scopes.rw (root).insert_out (out_base));
+ auto i (ctx.scopes.rw (root).insert_out (out_base));
scope& base (*i->second.front ());
scope* rs (nullptr);