diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-09-18 13:57:02 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-09-24 12:14:13 -0700 |
commit | ce04a279ae1f782983e448deb8b9b5d88c7921ad (patch) | |
tree | 4900dfc9c88eb12af322dfefa03ccd407bca5ebf /mesonbuild/ast/introspection.py | |
parent | d326c87fe22507b8c25078a7cd7ed88499ba7dc1 (diff) | |
download | meson-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.py | 15 |
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) |