Commit dbe55e3c authored by Emmanuele Bassi's avatar Emmanuele Bassi
Browse files

generate: Expose interface methods to the class template

Limit the list of methods for interfaces, like we do for ancestor
classes.
parent 96c995a7
......@@ -844,6 +844,12 @@ class TemplateClass:
for iface_type in cls.implements:
iface = namespace.find_interface(iface_type.name.split('.')[1])
if iface is not None:
# Set a hard-limit on the number of methods; base types can
# add *a lot* of them; two dozens feel like a good compromise
if len(iface.methods) < 24:
methods = [TemplateMethod(namespace, iface, m) for m in iface.methods]
else:
methods = []
self.interfaces.append({
"namespace": iface_type.name.split('.')[0],
"name": iface_type.name.split('.')[1],
......@@ -853,6 +859,8 @@ class TemplateClass:
"n_properties": len(iface.properties),
"signals": [TemplateSignal(namespace, iface, s) for s in iface.signals],
"n_signals": len(iface.signals),
"methods": methods,
"n_methods": len(iface.methods),
})
else:
self.interfaces.append({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment