mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Codegen: ignore synth properties in cppgen
This commit is contained in:
@@ -76,7 +76,7 @@ class Processor:
|
||||
bases=[self._get_class(b) for b in cls.bases],
|
||||
fields=[
|
||||
_get_field(cls, p, self._add_or_none_except)
|
||||
for p in cls.properties if "cpp_skip" not in p.pragmas
|
||||
for p in cls.properties if "cpp_skip" not in p.pragmas and not p.synth
|
||||
],
|
||||
final=not cls.derived,
|
||||
trap_name=trap_name,
|
||||
|
||||
@@ -203,5 +203,27 @@ def test_ipa_classes_ignored(generate):
|
||||
]
|
||||
|
||||
|
||||
def test_synth_properties_ignored(generate):
|
||||
assert generate([
|
||||
schema.Class(
|
||||
name="X",
|
||||
properties=[
|
||||
schema.SingleProperty("x", "a"),
|
||||
schema.SingleProperty("y", "b", synth=True),
|
||||
schema.SingleProperty("z", "c"),
|
||||
schema.OptionalProperty("foo", "bar", synth=True),
|
||||
schema.RepeatedProperty("baz", "bazz", synth=True),
|
||||
schema.RepeatedOptionalProperty("bazzz", "bazzzz", synth=True),
|
||||
schema.RepeatedUnorderedProperty("bazzzzz", "bazzzzzz", synth=True),
|
||||
],
|
||||
),
|
||||
]) == [
|
||||
cpp.Class(name="X", final=True, trap_name="Xes", fields=[
|
||||
cpp.Field("x", "a"),
|
||||
cpp.Field("z", "c"),
|
||||
]),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(pytest.main([__file__] + sys.argv[1:]))
|
||||
|
||||
Reference in New Issue
Block a user