summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorVolker Weißmann <volker.weissmann@gmx.de>2025-07-31 16:52:35 +0200
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-08-10 20:26:58 +0300
commit4b33c9cdb64f360c2ee19691baedfa4d0e32378f (patch)
tree672ce415e6a099d683d97b90b5c61bc04165dd6b /mesonbuild
parentf2c851b6f0452cad8bbbc5838c9a0f91aecdf593 (diff)
downloadmeson-4b33c9cdb64f360c2ee19691baedfa4d0e32378f.tar.gz
rewriter: Accept UnknownValue() in more places
Fixes #14840
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/ast/interpreter.py7
-rw-r--r--mesonbuild/ast/introspection.py8
2 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py
index 62c4839a7..86b644259 100644
--- a/mesonbuild/ast/interpreter.py
+++ b/mesonbuild/ast/interpreter.py
@@ -692,8 +692,11 @@ class AstInterpreter(InterpreterBase):
def func_get_variable(self, node: BaseNode, args: T.List[TYPE_var], kwargs: T.Dict[str, TYPE_var]) -> T.Any:
assert isinstance(node, FunctionNode)
var_name = args[0]
- assert isinstance(var_name, str)
- val = self.get_cur_value(var_name)
+ if isinstance(var_name, UnknownValue):
+ val: T.Union[UnknownValue, BaseNode] = UnknownValue()
+ else:
+ assert isinstance(var_name, str)
+ val = self.get_cur_value(var_name)
self.dataflow_dag.add_edge(val, node)
return val
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index decce4b3a..6ffc6adbe 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -203,9 +203,11 @@ class IntrospectionInterpreter(AstInterpreter):
has_fallback = 'fallback' in kwargs
required = kwargs.get('required', True)
version = kwargs.get('version', [])
- if not isinstance(version, UnknownValue):
- if not isinstance(version, list):
- version = [version]
+ if not isinstance(version, list):
+ version = [version]
+ if any(isinstance(el, UnknownValue) for el in version):
+ version = UnknownValue()
+ else:
assert all(isinstance(el, str) for el in version)
version = T.cast(T.List[str], version)
assert isinstance(required, (bool, UnknownValue))