Fix "methods returning this type" not accounting for vectors

This commit is contained in:
Lonami Exo 2019-07-15 10:05:26 +02:00
parent 944fb10733
commit de46745926
2 changed files with 11 additions and 4 deletions

View File

@ -230,7 +230,7 @@ def _write_html_pages(root, tlobjects, methods, layer, input_res):
type_to_functions = defaultdict(list)
for tlobject in tlobjects:
d = type_to_functions if tlobject.is_function else type_to_constructors
d[tlobject.result].append(tlobject)
d[tlobject.innermost_result].append(tlobject)
for t, cs in type_to_constructors.items():
type_to_constructors[t] = list(sorted(cs, key=lambda c: c.name))
@ -295,8 +295,7 @@ def _write_html_pages(root, tlobjects, methods, layer, input_res):
else:
if re.search('^vector<', tlobject.result, re.IGNORECASE):
docs.write_text('A list of the following type is returned.')
_, inner = tlobject.result.split('<')
inner = inner.strip('>')
inner = tlobject.innermost_result
else:
inner = tlobject.result
@ -558,7 +557,7 @@ def _write_html_pages(root, tlobjects, methods, layer, input_res):
if not tlobject.result.lower() in CORE_TYPES:
if re.search('^vector<', tlobject.result, re.IGNORECASE):
types.add(tlobject.result.split('<')[1].strip('>'))
types.add(tlobject.innermost_result)
else:
types.add(tlobject.result)

View File

@ -58,6 +58,14 @@ class TLObject:
self.real_args = list(a for a in self.sorted_args() if not
(a.flag_indicator or a.generic_definition))
@property
def innermost_result(self):
index = self.result.find('<')
if index == -1:
return self.result
else:
return self.result[index + 1:-1]
def sorted_args(self):
"""Returns the arguments properly sorted and ready to plug-in
into a Python's method header (i.e., flags and those which