From 10a4ed7c470d3fed8e2bb6b2089de68c61f9064b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 8 Jun 2020 12:25:21 +0300 Subject: Fix crashing when special builtin appears inside if condition or branch --- libbuild2/build/script/parser.hxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libbuild2/build/script/parser.hxx') 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_; -- cgit v1.1