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.
This commit is contained in:
Dylan Baker 2020-02-18 14:12:14 -08:00 committed by Nirbheek Chauhan
parent 4597235f92
commit cd30216ce4
1 changed files with 7 additions and 1 deletions

View File

@ -724,7 +724,13 @@ class Compiler:
return self.id
def get_linker_id(self) -> str:
# 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]