aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-06-11 23:26:17 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-06-20 16:24:45 -0400
commitf38c653a75492a8ec1fd95b1aa148aea13689ec3 (patch)
tree5d000e2fd1e665d51f6f7c2becee242efd9fc4b5 /mesonbuild
parent50921263bdf26b404f89c7e950d00438d01c316c (diff)
downloadmeson-f38c653a75492a8ec1fd95b1aa148aea13689ec3.zip
meson-f38c653a75492a8ec1fd95b1aa148aea13689ec3.tar.gz
meson-f38c653a75492a8ec1fd95b1aa148aea13689ec3.tar.bz2
backends/xcode: simplify an obviously too-complicated function
This function has a pretty unique name, and a simple grep shows that it is only ever called as: ``` add_comment(PbxComment('...........')) ``` It doesn't need to include logic such as handling str. Moreover it looks like that handling was broken anyway... it handled the case where comment is type str, by constructing a new PbxComment(str) instead of PbxComment(comment), a condition that cannot ever be valid (and crashed due to other assertions). Fixes: mesonbuild/backend/xcodebackend.py:148:42: error: Argument 1 to "PbxComment" has incompatible type "type[str]"; expected "str" [arg-type]
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/xcodebackend.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index 958465f..9c88eec 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -138,12 +138,9 @@ class PbxDict:
def has_item(self, key):
return key in self.keys
- def add_comment(self, comment: T.Union[str, PbxComment]) -> None:
- if isinstance(comment, str):
- self.items.append(PbxComment(str))
- else:
- assert isinstance(comment, PbxComment)
- self.items.append(comment)
+ def add_comment(self, comment: PbxComment) -> None:
+ assert isinstance(comment, PbxComment)
+ self.items.append(comment)
def write(self, ofile: T.TextIO, indent_level: int) -> None:
ofile.write('{\n')