Debian Codegraph @

tests/snapshots/cli/stack-switching/fun-state.wast/0.print

raw
1 (module $state
2 (type $gf (;0;) (func (param i32) (result i32)))
3 (type $sf (;1;) (func (result i32)))
4 (type $gk (;2;) (cont $gf))
5 (type $sk (;3;) (cont $sf))
6 (type (;4;) (func (param i32)))
7 (type (;5;) (func (param (ref $gk) i32) (result i32)))
8 (type (;6;) (func (result i32 (ref $sk))))
9 (type (;7;) (func (param i32 (ref $sk)) (result i32)))
10 (tag $get (;0;) (type $sf) (result i32))
11 (tag $set (;1;) (type 4) (param i32))
12 (export "run" (func 3))
13 (elem (;0;) declare func $f)
14 (func $getting (;0;) (type 5) (param $k (ref $gk)) (param $s i32) (result i32)
15 block $on_get (result (ref $gk))
16 block $on_set (type 6) (result i32 (ref $sk))
17 local.get $s
18 local.get $k
19 resume $gk (on $get $on_get) (on $set $on_set)
20 return
21 end
22 return_call $setting
23 end
24 local.get $s
25 return_call $getting
26 )
27 (func $setting (;1;) (type 7) (param $s i32) (param $k (ref $sk)) (result i32)
28 block $on_get (result (ref $gk))
29 block $on_set (type 6) (result i32 (ref $sk))
30 local.get $k
31 resume $sk (on $get $on_get) (on $set $on_set)
32 return
33 end
34 return_call $setting
35 end
36 local.get $s
37 return_call $getting
38 )
39 (func $f (;2;) (type $sf) (result i32)
40 i32.const 7
41 suspend $set
42 suspend $get
43 i32.const 2
44 i32.const 3
45 suspend $set
46 i32.const 3
47 suspend $get
48 i32.add
49 i32.mul
50 i32.add
51 )
52 (func (;3;) (type $sf) (result i32)
53 i32.const 0
54 ref.func $f
55 cont.new $sk
56 call $setting
57 )
58 )