From ee6e249f659cd4658ae2f1a425d4aa01585c23aa Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 25 Nov 2019 11:45:17 -0800 Subject: compilers: move language attribute to the class level We know that if a compiler class inherits CCompiler it's language will be C, so doing this at the class level makes more sense. --- mesonbuild/compilers/objc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mesonbuild/compilers/objc.py') diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index f69c57c..9f8bda8 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -27,10 +27,12 @@ if typing.TYPE_CHECKING: class ObjCCompiler(CLikeCompiler, Compiler): + + language = 'objc' + def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrap: typing.Optional[str], **kwargs): - self.language = 'objc' Compiler.__init__(self, exelist, version, for_machine, info, **kwargs) CLikeCompiler.__init__(self, is_cross, exe_wrap) -- cgit v1.1 From 7460e4ccda339d167402bd077dcaa364fab5e172 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 25 Nov 2019 12:05:19 -0800 Subject: compilers: Make get_display_language a class or static method Currently this is done at the instance level, but we need it at the class level to allow compiler "lang" args to be gotten early enough. This patch also removes a couple of instance of branch/leaf classes providing their own implementation that is identical to the Compiler version. --- mesonbuild/compilers/objc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild/compilers/objc.py') diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index 9f8bda8..a4aa5dc 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -36,7 +36,8 @@ class ObjCCompiler(CLikeCompiler, Compiler): Compiler.__init__(self, exelist, version, for_machine, info, **kwargs) CLikeCompiler.__init__(self, is_cross, exe_wrap) - def get_display_language(self): + @staticmethod + def get_display_language(): return 'Objective-C' def sanity_check(self, work_dir, environment): -- cgit v1.1