diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-07-02 11:18:00 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-08-16 16:21:51 -0700 |
commit | d8d09138c7af71705d8a5ec5b018ef73aa75d82b (patch) | |
tree | 2276cbf861d31b4df8caf5561f0c4651b7829b74 | |
parent | 5fe03cf8d91ad9477098373b44b6892c1deab6aa (diff) | |
download | meson-d8d09138c7af71705d8a5ec5b018ef73aa75d82b.zip meson-d8d09138c7af71705d8a5ec5b018ef73aa75d82b.tar.gz meson-d8d09138c7af71705d8a5ec5b018ef73aa75d82b.tar.bz2 |
interpreter: allow KwargInfo.evolve to change the name as well
-rw-r--r-- | mesonbuild/interpreterbase/decorators.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py index 1791deb..2f59dd7 100644 --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -339,6 +339,7 @@ class KwargInfo(T.Generic[_T]): self.not_set_warning = not_set_warning def evolve(self, *, + name: T.Union[str, _NULL_T] = _NULL, required: T.Union[bool, _NULL_T] = _NULL, listify: T.Union[bool, _NULL_T] = _NULL, default: T.Union[_T, None, _NULL_T] = _NULL, @@ -360,7 +361,7 @@ class KwargInfo(T.Generic[_T]): being replaced by either the copy in self, or the provided new version. """ return type(self)( - self.name, + name if not isinstance(name, _NULL_T) else self.name, self.types, listify=listify if not isinstance(listify, _NULL_T) else self.listify, required=required if not isinstance(required, _NULL_T) else self.required, |