Index: mojo/public/tools/bindings/pylib/mojom/generate/data.py |
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
index 01b9749ce85dadd3a49b970e169cf90999b57aff..331d2183b4dd43bf28fba5e3636f516471b21704 100644 |
--- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
@@ -322,6 +322,14 @@ def MethodFromData(module, data, interface): |
lambda parameter: ParameterFromData(module, parameter, interface), |
data['response_parameters']) |
method.attributes = data.get('attributes') |
+ |
+ # Enforce that only methods with response can have a [Sync] attribute. |
+ if method.sync and method.response_parameters is None: |
+ raise Exception("Only methods with response can include a [Sync] " |
+ "attribute. If no response parameters are needed, you " |
+ "could use an empty response parameter list, i.e., " |
+ "\"=> ()\".") |
+ |
return method |
def InterfaceToData(interface): |