Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 9624c23

Browse files
committed
add a little more complex case with a loop block
a modified copy from toywasm.
1 parent 24be425 commit 9624c23

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/core/try_table.wast

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,27 @@
376376
)
377377
"type mismatch"
378378
)
379+
380+
(module
381+
(tag $e (param i32))
382+
(func $dec-and-throw (param i32)
383+
local.get 0
384+
i32.eqz
385+
br_if 0
386+
local.get 0
387+
i32.const 1
388+
i32.sub
389+
throw $e
390+
)
391+
(func $loop (export "loop") (param i32)
392+
local.get 0
393+
loop (param i32)
394+
try_table (param i32) (catch $e 0)
395+
call $dec-and-throw
396+
end
397+
end
398+
)
399+
)
400+
401+
(assert_return (invoke "loop" (i32.const 0)))
402+
(assert_return (invoke "loop" (i32.const 1000000)))

0 commit comments

Comments
 (0)