aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-08 12:25:21 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-08 16:50:24 +0300
commit10a4ed7c470d3fed8e2bb6b2089de68c61f9064b (patch)
tree88818d092adca845740ef905a1d2ef256091b8a7 /libbuild2/build/script/parser.hxx
parent892c5c63cba987f3d74c47b730d600ab26f9c2e6 (diff)
Fix crashing when special builtin appears inside if condition or branch
Diffstat (limited to 'libbuild2/build/script/parser.hxx')
-rw-r--r--libbuild2/build/script/parser.hxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx
index a652cf4..73bcd09 100644
--- a/libbuild2/build/script/parser.hxx
+++ b/libbuild2/build/script/parser.hxx
@@ -181,6 +181,16 @@ namespace build2
//
line* save_line_;
+ // The if-else nesting level (and in the future for other flow
+ // control constructs).
+ //
+ // Maintained during pre-parsing and is incremented when the cmd_if or
+ // cmd_ifn lines are encountered, which in particular means that it is
+ // already incremented by the time the if-condition expression is
+ // pre-parsed. Decremented when the cmd_end line is encountered.
+ //
+ size_t level_ = 0;
+
// Execute state.
//
runner* runner_;