[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: if 'alias' in tp:
alias = tp['alias'] alias = tp['alias']
enum = tp['enum'] if 'enum' in tp else False enum = tp['enum'] if 'enum' in tp else False
tp = get_type_info(types, tp['alias']).copy()
tp['alias'] = alias tp = tp.copy()
tp['enum'] = enum realtype = get_type_info(types, tp['alias'])
generic = 'generic' in tp and tp['generic'] == True # copy certain properties from real type
# primitive types are always generic if 'generic' in realtype: tp['generic'] = realtype['generic']
if generic or not 'method' in tp: if 'method' in realtype: tp['method'] = realtype['method']
tp['type'] = name
# 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) # types without a 'type' value use their own name (e.g. double, float)
if not 'type' in tp: if not 'type' in tp: