Debian Codegraph @

tests/snapshots/cli/stack-switching/generators.wast/4.print

raw
1 (module $manager
2 (type $func (;0;) (func))
3 (type $cont (;1;) (cont $func))
4 (type (;2;) (func (param i32)))
5 (type (;3;) (func (param (ref $cont)) (result i32)))
6 (type (;4;) (func (param i32) (result i32)))
7 (type (;5;) (func (result i32 (ref $cont))))
8 (import "generator" "yield" (tag $yield (;0;) (type 2) (param i32)))
9 (table $active (;0;) 0 (ref null $cont))
10 (export "init" (func $init))
11 (export "next" (func $next))
12 (func $init (;0;) (type 3) (param $k (ref $cont)) (result i32)
13 local.get $k
14 i32.const 1
15 table.grow $active
16 )
17 (func $next (;1;) (type 4) (param $g i32) (result i32)
18 (local $next_k (ref $cont)) (local $next_v i32)
19 block $on_yield (type 5) (result i32 (ref $cont))
20 local.get $g
21 table.get $active
22 resume $cont (on $yield $on_yield)
23 i32.const -1
24 return
25 end
26 local.set $next_k
27 local.set $next_v
28 local.get $g
29 local.get $next_k
30 table.set $active
31 local.get $next_v
32 return
33 )
34 )