aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-04 12:53:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-08 14:26:22 +0300
commitd38dbf711c9532eea99607368278a8396b3db667 (patch)
treeab672c32b49a29a7c38edd121154fd7109717f28 /libbuild2/build/script/parser.hxx
parentfb34688841668e6e4c939395c8387feabe8ddfdf (diff)
In update ad hoc recipe buildscripts allow non-pure function calls only in depdeb preamble
Diffstat (limited to 'libbuild2/build/script/parser.hxx')
-rw-r--r--libbuild2/build/script/parser.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx
index e96a806..b5a45ca 100644
--- a/libbuild2/build/script/parser.hxx
+++ b/libbuild2/build/script/parser.hxx
@@ -121,6 +121,9 @@ namespace build2
virtual lookup
lookup_variable (name&&, string&&, const location&) override;
+ virtual void
+ lookup_function (string&&, const location&) override;
+
// During execution translate the process path and executable targets
// leaving the rest for the base parser to handle.
//
@@ -142,6 +145,11 @@ namespace build2
script* script_;
const adhoc_actions* actions_; // Non-NULL during pre-parsing.
+ // True if performing update is one of the actions. Only set for the
+ // pre-parse mode.
+ //
+ bool perform_update_;
+
// Current low-verbosity script diagnostics and its weight.
//
// During pre-parsing each command leading names are translated into a
@@ -197,6 +205,17 @@ namespace build2
optional<location> depdb_clear_; // 'depdb clear' location if any.
lines depdb_preamble_; // Note: excludes 'depdb clear'.
+ // If present, the first impure function called in the body of the
+ // script that performs update.
+ //
+ // Note that during the line pre-parsing we cannot tell if this is a
+ // body or depdb preamble line. Thus, if we encounter an impure
+ // function call we just save its name/location and postpone the
+ // potential failure till the end of the script pre-parsing, if it
+ // turns out to be a body line.
+ //
+ optional<pair<string, location>> impure_func_;
+
// True during pre-parsing when the pre-parse mode is temporarily
// suspended to perform expansion.
//