diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-09-26 11:09:23 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-10-06 22:37:18 +0200 |
commit | af0587cb490dfa2c2a00c2426c10d1de11d34fdd (patch) | |
tree | ea6cbdf3c861bebc3df145d4950211d45401dceb /mesonbuild/interpreterbase/_unholder.py | |
parent | b19530bd7dc99e0b5d71acd5cdf85af915b9ddcc (diff) | |
download | meson-af0587cb490dfa2c2a00c2426c10d1de11d34fdd.zip meson-af0587cb490dfa2c2a00c2426c10d1de11d34fdd.tar.gz meson-af0587cb490dfa2c2a00c2426c10d1de11d34fdd.tar.bz2 |
interpreter: Holderify arrays and dicts
This is the final refactoring for extracting the bultin object
logic out of Interpreterbase. I decided to do both arrays and
dicts in one go since splitting it would have been a lot more
confusing.
Diffstat (limited to 'mesonbuild/interpreterbase/_unholder.py')
-rw-r--r-- | mesonbuild/interpreterbase/_unholder.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/mesonbuild/interpreterbase/_unholder.py b/mesonbuild/interpreterbase/_unholder.py index 221c52c..7157d17 100644 --- a/mesonbuild/interpreterbase/_unholder.py +++ b/mesonbuild/interpreterbase/_unholder.py @@ -16,14 +16,8 @@ from .baseobjects import InterpreterObject, MesonInterpreterObject, ObjectHolder from .exceptions import InvalidArguments from ..mesonlib import HoldableObject, MesonBugException -import typing as T - -def _unholder(obj: T.Union[TYPE_var, InterpreterObject]) -> TYPE_var: - if isinstance(obj, list): - return [_unholder(x) for x in obj] - elif isinstance(obj, dict): - return {k: _unholder(v) for k, v in obj.items()} - elif isinstance(obj, ObjectHolder): +def _unholder(obj: InterpreterObject) -> TYPE_var: + if isinstance(obj, ObjectHolder): assert isinstance(obj.held_object, HoldableTypes) return obj.held_object elif isinstance(obj, MesonInterpreterObject): |