From 9624c23fc5c76b13dd352b13b5064145d0f12fc6 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 28 Aug 2024 14:30:31 +0900 Subject: [PATCH] add a little more complex case with a loop block a modified copy from toywasm. --- test/core/try_table.wast | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/core/try_table.wast b/test/core/try_table.wast index 43ae52cc..51599624 100644 --- a/test/core/try_table.wast +++ b/test/core/try_table.wast @@ -376,3 +376,27 @@ ) "type mismatch" ) + +(module + (tag $e (param i32)) + (func $dec-and-throw (param i32) + local.get 0 + i32.eqz + br_if 0 + local.get 0 + i32.const 1 + i32.sub + throw $e + ) + (func $loop (export "loop") (param i32) + local.get 0 + loop (param i32) + try_table (param i32) (catch $e 0) + call $dec-and-throw + end + end + ) +) + +(assert_return (invoke "loop" (i32.const 0))) +(assert_return (invoke "loop" (i32.const 1000000)))