aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test/script/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-08-04 15:52:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-08-04 15:53:17 +0300
commit112de2fc7317d1eed713191476ea7d5632674eaf (patch)
tree275bf72ba55f71a59f827cae693dedda586ec376 /libbuild2/test/script/parser.cxx
parent61c77b931a735a3305eabc3e1f0ae1a6cc4d3709 (diff)
Fix 'target.path() called out of scope' testscript error
Diffstat (limited to 'libbuild2/test/script/parser.cxx')
-rw-r--r--libbuild2/test/script/parser.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/libbuild2/test/script/parser.cxx b/libbuild2/test/script/parser.cxx
index b29ced9..944e1c8 100644
--- a/libbuild2/test/script/parser.cxx
+++ b/libbuild2/test/script/parser.cxx
@@ -1318,6 +1318,13 @@ namespace build2
include_set_ = nullptr;
scope_ = &sc;
+ // The script shouldn't be able to modify the scope.
+ //
+ // Note that we need it for calling functions which require the
+ // current scope, such as $target.path().
+ //
+ build2::parser::scope_ = const_cast<build2::scope*> (&s.target_scope);
+
//@@ PAT TODO: set pbase_?
exec_scope_body ();