Don't generate def resolve() for types

This would require nested resolving which could be quite
expensive. Instead there will just be a single level for
resolve() and it will belong in the requests.
This commit is contained in:
Lonami Exo 2018-07-07 12:17:29 +02:00
parent bb4ed4019f
commit 5d4b8a283d

View File

@ -233,7 +233,8 @@ def _write_class_init(tlobject, kind, type_constructors, builder):
def _write_resolve(tlobject, builder):
if any(arg.type in AUTO_CASTS for arg in tlobject.real_args):
if tlobject.is_function and\
any(arg.type in AUTO_CASTS for arg in tlobject.real_args):
builder.writeln('async def resolve(self, client, utils):')
for arg in tlobject.real_args:
ac = AUTO_CASTS.get(arg.type, None)