fix binding generation bug
This commit is contained in:
parent
6da260c051
commit
f922473ada
|
@ -119,6 +119,7 @@ for decl in data:
|
||||||
s += '\n{\n\t'
|
s += '\n{\n\t'
|
||||||
retTag = decl['ret']['tag']
|
retTag = decl['ret']['tag']
|
||||||
|
|
||||||
|
firstArgIndex = 0
|
||||||
if retTag == 'i':
|
if retTag == 'i':
|
||||||
s += 'returns[0].i32_val = '
|
s += 'returns[0].i32_val = '
|
||||||
elif retTag == 'I':
|
elif retTag == 'I':
|
||||||
|
@ -130,12 +131,11 @@ for decl in data:
|
||||||
elif retTag == 'S':
|
elif retTag == 'S':
|
||||||
retTypeName = decl['ret']['name']
|
retTypeName = decl['ret']['name']
|
||||||
retTypeCName = decl['ret'].get('cname', retTypeName)
|
retTypeCName = decl['ret'].get('cname', retTypeName)
|
||||||
s += '*(' + retTypeCName + '*)(bb_module_instance_mem(module, returns[0].i32_val, sizeof(' + retTypeCName + '))) = '
|
s += '*(' + retTypeCName + '*)(bb_module_instance_mem(module, params[0].i32_val, sizeof(' + retTypeCName + '))) = '
|
||||||
|
firstArgIndex = 1
|
||||||
|
|
||||||
s += cname + '('
|
s += cname + '('
|
||||||
|
|
||||||
firstArgIndex = 0
|
|
||||||
|
|
||||||
for i, arg in enumerate(decl['args']):
|
for i, arg in enumerate(decl['args']):
|
||||||
typeName = arg['type']['name']
|
typeName = arg['type']['name']
|
||||||
typeCName = arg['type'].get('cname', typeName)
|
typeCName = arg['type'].get('cname', typeName)
|
||||||
|
@ -209,7 +209,7 @@ for decl in data:
|
||||||
paramTypes.append(translateTag(tag))
|
paramTypes.append(translateTag(tag))
|
||||||
numParams += 1
|
numParams += 1
|
||||||
|
|
||||||
# dummy values to avoid 0-length arrays in C
|
# dummy values
|
||||||
if numReturns == 0:
|
if numReturns == 0:
|
||||||
retType = 'BB_VALTYPE_I32'
|
retType = 'BB_VALTYPE_I32'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue