Fix: Type error
That's what I get for cleaning up without running tests. This removes a intermediate hack to detect missing routes.
This commit is contained in:
parent
f8d107f4fa
commit
78c98b1e61
@ -385,18 +385,17 @@ def tuple_instantiation(wgn: WasmGenerator, inp: ourlang.TupleInstantiation) ->
|
|||||||
|
|
||||||
def expression_subscript_bytes(
|
def expression_subscript_bytes(
|
||||||
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
||||||
) -> bool:
|
) -> None:
|
||||||
wgn, inp = attrs
|
wgn, inp = attrs
|
||||||
|
|
||||||
expression(wgn, inp.varref)
|
expression(wgn, inp.varref)
|
||||||
expression(wgn, inp.index)
|
expression(wgn, inp.index)
|
||||||
wgn.call(stdlib_types.__subscript_bytes__)
|
wgn.call(stdlib_types.__subscript_bytes__)
|
||||||
return True
|
|
||||||
|
|
||||||
def expression_subscript_static_array(
|
def expression_subscript_static_array(
|
||||||
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
||||||
args: tuple[type3types.Type3, type3types.IntType3],
|
args: tuple[type3types.Type3, type3types.IntType3],
|
||||||
) -> bool:
|
) -> None:
|
||||||
wgn, inp = attrs
|
wgn, inp = attrs
|
||||||
|
|
||||||
el_type, el_len = args
|
el_type, el_len = args
|
||||||
@ -424,12 +423,11 @@ def expression_subscript_static_array(
|
|||||||
mtyp = LOAD_STORE_TYPE_MAP[el_type.name]
|
mtyp = LOAD_STORE_TYPE_MAP[el_type.name]
|
||||||
|
|
||||||
wgn.add_statement(f'{mtyp}.load')
|
wgn.add_statement(f'{mtyp}.load')
|
||||||
return True
|
|
||||||
|
|
||||||
def expression_subscript_tuple(
|
def expression_subscript_tuple(
|
||||||
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
attrs: tuple[WasmGenerator, ourlang.Subscript],
|
||||||
args: tuple[type3types.Type3, ...],
|
args: tuple[type3types.Type3, ...],
|
||||||
) -> bool:
|
) -> None:
|
||||||
wgn, inp = attrs
|
wgn, inp = attrs
|
||||||
|
|
||||||
assert isinstance(inp.index, ourlang.ConstantPrimitive)
|
assert isinstance(inp.index, ourlang.ConstantPrimitive)
|
||||||
@ -451,9 +449,8 @@ def expression_subscript_tuple(
|
|||||||
mtyp = LOAD_STORE_TYPE_MAP[el_type.name]
|
mtyp = LOAD_STORE_TYPE_MAP[el_type.name]
|
||||||
|
|
||||||
wgn.add_statement(f'{mtyp}.load', f'offset={offset}')
|
wgn.add_statement(f'{mtyp}.load', f'offset={offset}')
|
||||||
return True
|
|
||||||
|
|
||||||
SUBSCRIPT_ROUTER = type3types.TypeApplicationRouter[tuple[WasmGenerator, ourlang.Subscript], bool]()
|
SUBSCRIPT_ROUTER = type3types.TypeApplicationRouter[tuple[WasmGenerator, ourlang.Subscript], None]()
|
||||||
SUBSCRIPT_ROUTER.add_n(prelude.bytes_, expression_subscript_bytes)
|
SUBSCRIPT_ROUTER.add_n(prelude.bytes_, expression_subscript_bytes)
|
||||||
SUBSCRIPT_ROUTER.add(prelude.static_array, expression_subscript_static_array)
|
SUBSCRIPT_ROUTER.add(prelude.static_array, expression_subscript_static_array)
|
||||||
SUBSCRIPT_ROUTER.add(prelude.tuple_, expression_subscript_tuple)
|
SUBSCRIPT_ROUTER.add(prelude.tuple_, expression_subscript_tuple)
|
||||||
@ -590,7 +587,8 @@ def expression(wgn: WasmGenerator, inp: ourlang.Expression) -> None:
|
|||||||
assert inp.varref.type3 is not None, TYPE3_ASSERTION_ERROR
|
assert inp.varref.type3 is not None, TYPE3_ASSERTION_ERROR
|
||||||
|
|
||||||
# Type checker guarantees we don't get routing errors
|
# Type checker guarantees we don't get routing errors
|
||||||
return SUBSCRIPT_ROUTER((wgn, inp, ), inp.varref.type3)
|
SUBSCRIPT_ROUTER((wgn, inp, ), inp.varref.type3)
|
||||||
|
return
|
||||||
|
|
||||||
if isinstance(inp, ourlang.AccessStructMember):
|
if isinstance(inp, ourlang.AccessStructMember):
|
||||||
assert inp.struct_type3 is not None, TYPE3_ASSERTION_ERROR
|
assert inp.struct_type3 is not None, TYPE3_ASSERTION_ERROR
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user