diff --git a/phasm/compiler.py b/phasm/compiler.py index 328f04d..4b90740 100644 --- a/phasm/compiler.py +++ b/phasm/compiler.py @@ -385,18 +385,17 @@ def tuple_instantiation(wgn: WasmGenerator, inp: ourlang.TupleInstantiation) -> def expression_subscript_bytes( attrs: tuple[WasmGenerator, ourlang.Subscript], - ) -> bool: + ) -> None: wgn, inp = attrs expression(wgn, inp.varref) expression(wgn, inp.index) wgn.call(stdlib_types.__subscript_bytes__) - return True def expression_subscript_static_array( attrs: tuple[WasmGenerator, ourlang.Subscript], args: tuple[type3types.Type3, type3types.IntType3], - ) -> bool: + ) -> None: wgn, inp = attrs el_type, el_len = args @@ -424,12 +423,11 @@ def expression_subscript_static_array( mtyp = LOAD_STORE_TYPE_MAP[el_type.name] wgn.add_statement(f'{mtyp}.load') - return True def expression_subscript_tuple( attrs: tuple[WasmGenerator, ourlang.Subscript], args: tuple[type3types.Type3, ...], - ) -> bool: + ) -> None: wgn, inp = attrs assert isinstance(inp.index, ourlang.ConstantPrimitive) @@ -451,9 +449,8 @@ def expression_subscript_tuple( mtyp = LOAD_STORE_TYPE_MAP[el_type.name] 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(prelude.static_array, expression_subscript_static_array) 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 # 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): assert inp.struct_type3 is not None, TYPE3_ASSERTION_ERROR