From 5910fbb854d7aa957091aa48a248b2de239eb558 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 May 2020 14:50:56 +0200 Subject: Integrate buildscript pre-parsing into recipe parsing --- libbuild2/rule.hxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libbuild2/rule.hxx') diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index 975dd59..8799b83 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -12,6 +12,8 @@ #include #include +#include + #include namespace build2 @@ -143,7 +145,7 @@ namespace build2 match (action, target&, const string&) const override; virtual void - dump (ostream&, const string& indentation) const = 0; + dump (ostream&, string& indentation) const = 0; // Implementation details. // @@ -178,16 +180,18 @@ namespace build2 default_action (action, const target&) const; virtual void - dump (ostream&, const string&) const override; + dump (ostream&, string&) const override; + + using script_type = build::script::script; - adhoc_script_rule (string c, + adhoc_script_rule (script_type&& s, optional d, const location& l, size_t b) - : adhoc_rule (l, b), code (move (c)), diag (move (d)) {} + : adhoc_rule (l, b), script (move (s)), diag (move (d)) {} public: - string code; - optional diag; // Command name for low-verbosity diagnostics. + const script_type script; + const optional diag; // Command name for low-verbosity diag. }; // Ad hoc C++ rule. @@ -218,7 +222,7 @@ namespace build2 apply (action, target&) const override; virtual void - dump (ostream&, const string&) const override; + dump (ostream&, string&) const override; adhoc_cxx_rule (string c, const location& l, size_t b) : adhoc_rule (l, b), code (move (c)), impl (nullptr) {} -- cgit v1.1