[protocol] Simplify aliasing, use correct name and size

This commit is contained in:
Alpyne 2020-10-31 02:17:58 -07:00
parent 4c3bf292fb
commit ac62c9d25e
1 changed files with 10 additions and 7 deletions

View File

@ -91,13 +91,16 @@ def get_type_info(types, typename):
if 'alias' in tp:
alias = tp['alias']
enum = tp['enum'] if 'enum' in tp else False
tp = get_type_info(types, tp['alias']).copy()
tp['alias'] = alias
tp['enum'] = enum
generic = 'generic' in tp and tp['generic'] == True
# primitive types are always generic
if generic or not 'method' in tp:
tp['type'] = name
tp = tp.copy()
realtype = get_type_info(types, tp['alias'])
# copy certain properties from real type
if 'generic' in realtype: tp['generic'] = realtype['generic']
if 'method' in realtype: tp['method'] = realtype['method']
# use real type's size if we have none
if 'size' in realtype and not 'size' in tp:
tp['size'] = realtype['size']
# types without a 'type' value use their own name (e.g. double, float)
if not 'type' in tp: