aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-05-19 19:57:46 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-27 08:35:29 +0200
commit51ae6dcf64ce1de3f0f28228050c7db1776e5b1b (patch)
treee4dac1b667de57d56d8a831235fc3b04e3700031 /libbuild2/build
parent52f3c1825660cbf9a5b39abbbbd04bc4f8172f69 (diff)
Remove redundant script member from build::script::environment class
Diffstat (limited to 'libbuild2/build')
-rw-r--r--libbuild2/build/script/parser.cxx6
-rw-r--r--libbuild2/build/script/parser.hxx2
-rw-r--r--libbuild2/build/script/parser.test.cxx4
-rw-r--r--libbuild2/build/script/script.cxx3
-rw-r--r--libbuild2/build/script/script.hxx3
5 files changed, 8 insertions, 10 deletions
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx
index c64bcd9..9c397f1 100644
--- a/libbuild2/build/script/parser.cxx
+++ b/libbuild2/build/script/parser.cxx
@@ -240,7 +240,7 @@ namespace build2
//
void parser::
- execute (environment& e, runner& r)
+ execute (const script& s, environment& e, runner& r)
{
path_ = nullptr; // Set by replays.
@@ -248,7 +248,7 @@ namespace build2
set_lexer (nullptr);
- script_ = nullptr;
+ script_ = const_cast<script*> (&s);
runner_ = &r;
environment_ = &e;
@@ -258,7 +258,7 @@ namespace build2
void parser::
exec_script ()
{
- const script& s (environment_->script);
+ const script& s (*script_);
runner_->enter (*environment_, s.start_loc);
diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx
index 40f4c62..7183509 100644
--- a/libbuild2/build/script/parser.hxx
+++ b/libbuild2/build/script/parser.hxx
@@ -68,7 +68,7 @@ namespace build2
//
public:
void
- execute (environment&, runner&);
+ execute (const script&, environment&, runner&);
protected:
void
diff --git a/libbuild2/build/script/parser.test.cxx b/libbuild2/build/script/parser.test.cxx
index 705fd9d..b5afd47 100644
--- a/libbuild2/build/script/parser.test.cxx
+++ b/libbuild2/build/script/parser.test.cxx
@@ -131,9 +131,9 @@ namespace build2
if (!dump)
{
- environment e (s, tt);
+ environment e (tt);
print_runner r (line);
- p.execute (e, r);
+ p.execute (s, e, r);
}
else
build2::script::dump (cout, "", s.lines);
diff --git a/libbuild2/build/script/script.cxx b/libbuild2/build/script/script.cxx
index 2a796ab..cbd41c7 100644
--- a/libbuild2/build/script/script.cxx
+++ b/libbuild2/build/script/script.cxx
@@ -20,7 +20,7 @@ namespace build2
static const string wd_name ("current directory");
environment::
- environment (const build::script::script& s, const target& pt)
+ environment (const target& pt)
: build2::script::environment (
pt.ctx,
cast<target_triplet> (pt.ctx.global_scope["build.host"]),
@@ -29,7 +29,6 @@ namespace build2
redirect (redirect_type::none),
redirect (redirect_type::merge, 2),
redirect (redirect_type::pass)),
- script (s),
primary_target (pt),
vars (context, false /* global */)
{
diff --git a/libbuild2/build/script/script.hxx b/libbuild2/build/script/script.hxx
index 9ada56f..1540ed8 100644
--- a/libbuild2/build/script/script.hxx
+++ b/libbuild2/build/script/script.hxx
@@ -52,7 +52,7 @@ namespace build2
class environment: public build2::script::environment
{
public:
- environment (const script&, const target& primary_target);
+ environment (const target& primary_target);
environment (environment&&) = delete;
environment (const environment&) = delete;
@@ -60,7 +60,6 @@ namespace build2
environment& operator= (const environment&) = delete;
public:
- const build::script::script& script;
const target& primary_target;
// Script-local variable pool.