Interpreter: Fix subdir_done() to exit from inside if/foreach blocks
Closes: #3700.
This commit is contained in:
parent
e581a8937f
commit
2d3bfa0778
|
@ -3128,7 +3128,10 @@ root and issuing %s.
|
|||
except mesonlib.MesonException as me:
|
||||
me.file = buildfilename
|
||||
raise me
|
||||
self.evaluate_codeblock(codeblock)
|
||||
try:
|
||||
self.evaluate_codeblock(codeblock)
|
||||
except SubdirDoneRequest:
|
||||
pass
|
||||
self.subdir = prev_subdir
|
||||
|
||||
def _get_kwarg_install_mode(self, kwargs):
|
||||
|
|
|
@ -326,7 +326,10 @@ class InterpreterBase:
|
|||
def run(self):
|
||||
# Evaluate everything after the first line, which is project() because
|
||||
# we already parsed that in self.parse_project()
|
||||
self.evaluate_codeblock(self.ast, start=1)
|
||||
try:
|
||||
self.evaluate_codeblock(self.ast, start=1)
|
||||
except SubdirDoneRequest:
|
||||
pass
|
||||
|
||||
def evaluate_codeblock(self, node, start=0, end=None):
|
||||
if node is None:
|
||||
|
@ -343,8 +346,6 @@ class InterpreterBase:
|
|||
try:
|
||||
self.current_lineno = cur.lineno
|
||||
self.evaluate_statement(cur)
|
||||
except SubdirDoneRequest:
|
||||
break
|
||||
except Exception as e:
|
||||
if not(hasattr(e, 'lineno')):
|
||||
e.lineno = cur.lineno
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
project('example exit', 'cpp')
|
||||
|
||||
subdir_done()
|
||||
if true
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
executable('main', 'main.cpp')
|
||||
error('Unreachable')
|
||||
|
|
Loading…
Reference in New Issue