(self)
We use the order of languages in `clink_langs` to determine which
        linker to use in case the target has sources compiled with multiple
        compilers. All languages other than those in this list have their own
        linker.
        Note that Vala outputs C code, so Vala sources can use any linker
        that can link compiled C. We don't actually need to add an exception
        for Vala here because of that.
We use the order of languages in `clink_langs` to determine which
        linker to use in case the target has sources compiled with multiple
        compilers. All languages other than those in this list have their own
        linker.
        Note that Vala outputs C code, so Vala sources can use any linker
        that can link compiled C. We don't actually need to add an exception
        for Vala here because of that.
We use the order of languages in clink_langs to determine which linker to use in case the target has sources compiled with multiple compilers . All languages other than those in this list have their own linker . Note that Vala outputs C code so Vala sources can use any linker that can link compiled C . We don t actually need to add an exception for Vala here because of that .
def get_clink_dynamic_linker_and_stdlibs(self) -> T.Tuple['Compiler', T.List[str]]:
        '''
        We use the order of languages in `clink_langs` to determine which
        linker to use in case the target has sources compiled with multiple
        compilers. All languages other than those in this list have their own
        linker.
        Note that Vala outputs C code, so Vala sources can use any linker
        that can link compiled C. We don't actually need to add an exception
        for Vala here because of that.
        '''
        # Populate list of all compilers, not just those being used to compile
        # sources in this target
        all_compilers = self.environment.coredata.compilers[self.for_machine]

        # If the user set the link_language, just return that.
        if self.link_language:
            comp = all_compilers[self.link_language]
            return comp, comp.language_stdlib_only_link_flags(self.environment)

        # Languages used by dependencies
        dep_langs = self.get_langs_used_by_deps()
        # Pick a compiler based on the language priority-order
        for l in clink_langs:
            if l in self.compilers or l in dep_langs:
                try:
                    linker = all_compilers[l]
                except KeyError:
                    raise MesonException(
                        f'Could not get a dynamic linker for build target {self.name!r}. '
                        f'Requires a linker for language "{l}", but that is not '
                        'a project language.')
                stdlib_args: T.List[str] = []
                added_languages: T.Set[str] = set()
                for dl in itertools.chain(self.compilers, dep_langs):
                    if dl != linker.language:
                        stdlib_args += all_compilers[dl].language_stdlib_only_link_flags(self.environment)
                        added_languages.add(dl)
                # Type of var 'linker' is Compiler.
                # Pretty hard to fix because the return value is passed everywhere
                return linker, stdlib_args

        raise AssertionError(f'Could not get a dynamic linker for build target {self.name!r}')
def get_clink_dynamic_linker_and_stdlibs ( self ) -> T . Tuple [ 'Compiler' , T . List [ str ] ] : # Populate list of all compilers, not just those being used to compile # sources in this target all_compilers = self . environment . coredata . compilers [ self . for_machine ] # If the user set the link_language, just return that. if self . link_language : comp = all_compilers [ self . link_language ] return comp , comp . language_stdlib_only_link_flags ( self . environment ) # Languages used by dependencies dep_langs = self . get_langs_used_by_deps ( ) # Pick a compiler based on the language priority-order for l in clink_langs : if l in self . compilers or l in dep_langs : try : linker = all_compilers [ l ] except KeyError : raise MesonException ( f'Could not get a dynamic linker for build target {self.name!r}. ' f'Requires a linker for language "{l}", but that is not ' 'a project language.' ) stdlib_args : T . List [ str ] = [ ] added_languages : T . Set [ str ] = set ( ) for dl in itertools . chain ( self . compilers , dep_langs ) : if dl != linker . language : stdlib_args += all_compilers [ dl ] . language_stdlib_only_link_flags ( self . environment ) added_languages . add ( dl ) # Type of var 'linker' is Compiler. # Pretty hard to fix because the return value is passed everywhere return linker , stdlib_args raise AssertionError ( f'Could not get a dynamic linker for build target {self.name!r}' )