compilers/compilers: Fix get_linker_id

Which could raise an AttributeError when used on languages like Java and
C# that don't have separate compilers and linkers.
pull/6672/head
Dylan Baker 5 years ago committed by Nirbheek Chauhan
parent 4597235f92
commit cd30216ce4
  1. 8
      mesonbuild/compilers/compilers.py

@ -724,7 +724,13 @@ class Compiler:
return self.id
def get_linker_id(self) -> str:
return self.linker.id
# There is not guarantee that we have a dynamic linker instance, as
# some languages don't have separate linkers and compilers. In those
# cases return the compiler id
try:
return self.linker.id
except AttributeError:
return self.id
def get_version_string(self) -> str:
details = [self.id, self.version]

Loading…
Cancel
Save