Simplify deny logic for methods.
Passing values by structure will work now. We explicitly deny
the methods we don't want (free members).
We can use the include_structure logic to block methods by
structure use and avoid logic duplication.
Bug: 357843314
Change-Id: Ib81bb4986fe3e0dace4ddd991672a8de855e8500
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/201494
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jim Blackler <jimblackler@google.com>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index eee6c70..b38ee80 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -858,15 +858,15 @@
# TODO(b/352047733): Replace methods that require special handling with an exceptions list.
def include_method(method):
+ if method.name.canonical_case().endswith(" free members"):
+ return False
if method.return_type.category == 'function pointer':
# Kotlin doesn't support returning functions.
return False
for argument in method.arguments:
- if argument.type.category == 'callback info':
- # We don't handle this yet.
- return False
- if argument.annotation == 'value' and argument.type.category == 'structure':
- # Passing structures by value is not supported at the moment.
+ # Any method that has unsupported structures as parameters is itself unsupported.
+ if argument.type.category == 'structure' and not include_structure(
+ argument.type):
return False
return True