From 112de2fc7317d1eed713191476ea7d5632674eaf Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Aug 2020 15:52:59 +0300 Subject: Fix 'target.path() called out of scope' testscript error --- libbuild2/test/script/parser.cxx | 7 +++++++ 1 file changed, 7 insertions(+) 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_ = ≻ + // 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 (&s.target_scope); + //@@ PAT TODO: set pbase_? exec_scope_body (); -- cgit v1.1