From 7f9a7fe2ffc82c39a777a8009e8b9208e72ac416 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 7 Oct 2022 20:32:11 -0500 Subject: [PATCH] tiny bugfixes --- compiler/src/wasm_emit.c | 4 ++++ core/container/iter.onyx | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/src/wasm_emit.c b/compiler/src/wasm_emit.c index 6978c6dd..21e36939 100644 --- a/compiler/src/wasm_emit.c +++ b/compiler/src/wasm_emit.c @@ -1619,6 +1619,10 @@ EMIT_FUNC(switch, AstSwitch* switch_node) { WID(switch_node->expr->token, WI_BLOCK_START, 0x40); emit_expression(mod, &code, switch_node->expr); if (switch_node->min_case != 0) { + if (onyx_type_to_wasm_type(switch_node->expr->type) == WASM_TYPE_INT64) { + WI(switch_node->expr->token, WI_I32_FROM_I64); + } + WID(switch_node->expr->token, WI_I32_CONST, switch_node->min_case); WI(switch_node->expr->token, WI_I32_SUB); } diff --git a/core/container/iter.onyx b/core/container/iter.onyx index b3516fdc..d490e7a9 100644 --- a/core/container/iter.onyx +++ b/core/container/iter.onyx @@ -9,7 +9,9 @@ Iterable :: interface (t: $T) { } close :: (it: Iterator($T)) { - it.close(it.data); + if it.close != null_proc { + it.close(it.data); + } } filter :: #match #local {} -- 2.25.1