aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/test/rule.cxx3
-rw-r--r--build2/test/script/parser8
-rw-r--r--build2/test/script/parser.cxx17
-rw-r--r--build2/test/script/script2
-rw-r--r--unit-tests/test/script/parser/driver.cxx4
5 files changed, 16 insertions, 18 deletions
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 487856b..089f560 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -424,7 +424,8 @@ namespace build2
text << "test " << t << " with " << ts;
script::parser p;
- script::script s (p.pre_parse (ts, t, wd));
+ script::script s (t, ts, wd);
+ p.pre_parse (s);
script::concurrent_runner r;
p.parse (s, r);
diff --git a/build2/test/script/parser b/build2/test/script/parser
index 30e39b9..b99c487 100644
--- a/build2/test/script/parser
+++ b/build2/test/script/parser
@@ -28,11 +28,11 @@ namespace build2
public:
// Issue diagnostics and throw failed in case of an error.
//
- script
- pre_parse (testscript&, target&, const dir_path& root_wd);
+ void
+ pre_parse (script&);
- script
- pre_parse (istream&, testscript&, target&, const dir_path& root_wd);
+ void
+ pre_parse (istream&, script&);
void
parse (script& s, runner& r)
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index de453e5..5902008 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -30,16 +30,16 @@ namespace build2
return !s.empty ();
}
- script parser::
- pre_parse (testscript& ts, target& tg, const dir_path& wd)
+ void parser::
+ pre_parse (script& s)
{
- const path& p (ts.path ());
+ const path& p (s.script_target.path ());
assert (!p.empty ()); // Should have been assigned.
try
{
ifdstream ifs (p);
- return pre_parse (ifs, ts, tg, wd);
+ pre_parse (ifs, s);
}
catch (const io_error& e)
{
@@ -48,11 +48,10 @@ namespace build2
}
}
- script parser::
- pre_parse (istream& is, testscript& ts, target& tg, const dir_path& wd)
+ void parser::
+ pre_parse (istream& is, script& s)
{
- script s (tg, ts, wd);
- path_ = &*s.paths_.insert (ts.path ()).first;
+ path_ = &*s.paths_.insert (s.script_target.path ()).first;
pre_parse_ = true;
@@ -83,8 +82,6 @@ namespace build2
fail (t) << "stray " << t;
group_->end_loc_ = get_location (t);
-
- return s;
}
void parser::
diff --git a/build2/test/script/script b/build2/test/script/script
index 6d121ea..0964af1 100644
--- a/build2/test/script/script
+++ b/build2/test/script/script
@@ -371,7 +371,7 @@ namespace build2
testscript& script_target,
const dir_path& root_wd);
- script (script&&) = default;
+ script (script&&) = delete;
script (const script&) = delete;
script& operator= (script&&) = delete;
script& operator= (const script&) = delete;
diff --git a/unit-tests/test/script/parser/driver.cxx b/unit-tests/test/script/parser/driver.cxx
index deb9994..badb658 100644
--- a/unit-tests/test/script/parser/driver.cxx
+++ b/unit-tests/test/script/parser/driver.cxx
@@ -165,8 +165,8 @@ namespace build2
// Parse and run.
//
parser p;
- script s (
- p.pre_parse (cin, st, tt, dir_path (work) /= "test-driver"));
+ script s (tt, st, dir_path (work) /= "test-driver");
+ p.pre_parse (cin, s);
print_runner r (scope, id);
p.parse (s, r);