Swift: add trapgen unit tests

Closes: https://github.com/github/codeql-c-team/issues/981
This commit is contained in:
Paolo Tranquilli
2022-05-03 17:33:25 +02:00
parent 8e33653d25
commit 10c5c8e71f
11 changed files with 372 additions and 52 deletions

View File

@@ -21,12 +21,14 @@ class Field:
type: str
first: bool = False
@property
def cpp_name(self):
if self.name in cpp_keywords:
return self.name + "_"
return self.name
def stream(self):
# using @property breaks pystache internals here
def get_streamer(self):
if self.type == "std::string":
return lambda x: f"trapQuoted({x})"
elif self.type == "bool":
@@ -65,6 +67,7 @@ class Tag:
self.bases = [TagBase(b) for b in self.bases]
self.bases[0].first = True
@property
def has_bases(self):
return bool(self.bases)