Browse Source

[protocol] Simplify aliasing, use correct name and size

main
Alpyne 2 years ago
parent
commit
ac62c9d25e
  1. 17
      src/protocol/generate_protocol.py

17
src/protocol/generate_protocol.py

@ -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:

Loading…
Cancel
Save