generator: allow js to handle primitive arrays [2/11]
@@ -140,7 +140,10 @@ def construct_format(f, type_map=CONSTRUCT_CODE):
else:
field_type = "'%s'" % field_type
if size is not None:
- return "array('%s', { length: %d, type: %s })" % (f.identifier, size.value, field_type)
+ d = { "'uint16'" : "'uint16le'", "'uint32'" : "'uint32le'", "'uint64'" : "'uint16le'",
+ "'int16'" : "'int16le'", "'int32'" : "'int32le'", "'int64'" : "'int16le'" }
+ field_type_arr = d.get(field_type, field_type)
+ return "array('%s', { length: %d, type: %s })" % (f.identifier, size.value, field_type_arr)
elif f.options.get('size_fn') is not None:
return "array('%s', { type: %s, length: '%s' })" % (f_.identifier, field_type, size_fn.value)
else:
