summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase/baseobjects.py
diff options
context:
space:
mode:
authorVolker Weißmann <volker.weissmann@gmx.de>2025-06-02 18:04:50 +0200
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-06-09 21:01:09 +0300
commit4a57a5fd0cdd5064a03566f40b61c827f27ea529 (patch)
tree575074ebb07a3d786787e62c328c121653e53433 /mesonbuild/interpreterbase/baseobjects.py
parenta3f43cbc5b3738bd26f421d00c1b53736364954c (diff)
downloadmeson-4a57a5fd0cdd5064a03566f40b61c827f27ea529.tar.gz
AstInterpreter: Fix dead-code-crash
Without this commit, the rewriter and the static introspection tool crash if `meson.build` contains something like ```meson if false foo = not_defined endif ``` or ```meson if false message(not_defined) endif ``` While it could be argued, that you should not write stuff like this, this used to raise a `MesonBugException`, which we have to fix. Fixes #14667
Diffstat (limited to 'mesonbuild/interpreterbase/baseobjects.py')
-rw-r--r--mesonbuild/interpreterbase/baseobjects.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/interpreterbase/baseobjects.py b/mesonbuild/interpreterbase/baseobjects.py
index 7cda5729f..5ad6f4351 100644
--- a/mesonbuild/interpreterbase/baseobjects.py
+++ b/mesonbuild/interpreterbase/baseobjects.py
@@ -127,6 +127,10 @@ class UnknownValue(MesonInterpreterObject):
limitations in our code or because the value differs from machine to
machine.'''
+class UndefinedVariable(MesonInterpreterObject):
+ '''This class is only used for the rewriter/static introspection tool and
+ represents the `value` a meson-variable has if it was never written to.'''
+
HoldableTypes = (HoldableObject, int, bool, str, list, dict)
TYPE_HoldableTypes = T.Union[TYPE_var, HoldableObject]
InterpreterObjectTypeVar = T.TypeVar('InterpreterObjectTypeVar', bound=TYPE_HoldableTypes)