aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/introspection.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-09-18 13:57:02 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-09-24 12:14:13 -0700
commitce04a279ae1f782983e448deb8b9b5d88c7921ad (patch)
tree4900dfc9c88eb12af322dfefa03ccd407bca5ebf /mesonbuild/ast/introspection.py
parentd326c87fe22507b8c25078a7cd7ed88499ba7dc1 (diff)
downloadmeson-ce04a279ae1f782983e448deb8b9b5d88c7921ad.zip
meson-ce04a279ae1f782983e448deb8b9b5d88c7921ad.tar.gz
meson-ce04a279ae1f782983e448deb8b9b5d88c7921ad.tar.bz2
ast/introspection: Fix typing violation due to untyped functions
When we add type annotations to this in compilers this will break, unless we've already filtered out the non-string arguments.
Diffstat (limited to 'mesonbuild/ast/introspection.py')
-rw-r--r--mesonbuild/ast/introspection.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index f03f7d2..9cfdded 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -151,14 +151,15 @@ class IntrospectionInterpreter(AstInterpreter):
for for_machine in [MachineChoice.BUILD, MachineChoice.HOST]:
self._add_languages(args, for_machine)
- def _add_languages(self, langs: T.List[TYPE_nvar], for_machine: MachineChoice) -> None:
- langs = self.flatten_args(langs)
+ def _add_languages(self, raw_langs: T.List[TYPE_nvar], for_machine: MachineChoice) -> None:
+ langs = [] # type: T.List[str]
+ for l in self.flatten_args(raw_langs):
+ if isinstance(l, str):
+ langs.append(l)
+ elif isinstance(l, StringNode):
+ langs.append(l.value)
+
for lang in sorted(langs, key=compilers.sort_clink):
- if isinstance(lang, StringNode):
- assert isinstance(lang.value, str)
- lang = lang.value
- if not isinstance(lang, str):
- continue
lang = lang.lower()
if lang not in self.coredata.compilers[for_machine]:
self.environment.detect_compiler_for(lang, for_machine)