Support static array of tuples
This commit is contained in:
parent
fcbd32a880
commit
4a4c62c728
@ -39,7 +39,7 @@ def type3(inp: Type3OrPlaceholder) -> str:
|
||||
assert isinstance(inp.args[0], Type3), TYPE3_ASSERTION_ERROR
|
||||
assert isinstance(inp.args[1], type3types.IntType3), TYPE3_ASSERTION_ERROR
|
||||
|
||||
return inp.args[0].name + '[' + inp.args[1].name + ']'
|
||||
return type3(inp.args[0]) + '[' + inp.args[1].name + ']'
|
||||
|
||||
return inp.name
|
||||
|
||||
|
||||
@ -644,8 +644,6 @@ class OurVisitor:
|
||||
_raise_static_error(node, f'Unrecognized type {node.id}')
|
||||
|
||||
if isinstance(node, ast.Subscript):
|
||||
if not isinstance(node.value, ast.Name):
|
||||
_raise_static_error(node, 'Must be name')
|
||||
if isinstance(node.slice, ast.Slice):
|
||||
_raise_static_error(node, 'Must subscript using an index')
|
||||
if not isinstance(node.slice, ast.Constant):
|
||||
@ -655,11 +653,6 @@ class OurVisitor:
|
||||
if not isinstance(node.ctx, ast.Load):
|
||||
_raise_static_error(node, 'Must be load context')
|
||||
|
||||
if (
|
||||
node.value.id not in type3types.LOOKUP_TABLE
|
||||
and node.value.id not in module.struct_definitions): # FIXME: Tuple of tuples?
|
||||
_raise_static_error(node, f'Unrecognized type {node.value.id}')
|
||||
|
||||
return type3types.AppliedType3(
|
||||
type3types.static_array,
|
||||
[self.visit_type(module, node.value), type3types.IntType3(node.slice.value)],
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"TYPE_NAME": "static_array_tuple_u32_u32_3",
|
||||
"TYPE": "(u32, u32, )[3]",
|
||||
"VAL0": "((1, 100, ), (2, 200, ), (3, 300, ), )"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user