Debian Codegraph @

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

raw
1 (module
2 (type $func (;0;) (func))
3 (type $cont (;1;) (cont $func))
4 (type (;2;) (func (param i32)))
5 (type (;3;) (func (param i32 (ref $cont))))
6 (type (;4;) (func (param i32 (ref $cont)) (result i32)))
7 (type (;5;) (func (param (ref $cont)) (result i32)))
8 (type (;6;) (func (param i32) (result i32)))
9 (type (;7;) (func (param i32 i32)))
10 (import "spectest" "print_i32" (func $log (;0;) (type 2)))
11 (import "examples" "naturals" (func $naturals (;1;) (type $func)))
12 (import "examples" "fibonacci" (func $fibonacci (;2;) (type $func)))
13 (import "examples" "one-two-three" (func $one-two-three (;3;) (type $func)))
14 (import "examples" "print-first" (func $print-first (;4;) (type 3)))
15 (import "examples" "sum-first" (func $sum-first (;5;) (type 4)))
16 (import "manager" "init" (func $init (;6;) (type 5)))
17 (import "manager" "next" (func $next (;7;) (type 6)))
18 (export "main" (func $main))
19 (elem (;0;) declare func $naturals $fibonacci $one-two-three)
20 (func $print-with-next (;8;) (type 7) (param $n i32) (param $gen i32)
21 loop $l
22 local.get $n
23 i32.eqz
24 if ;; label = @2
25 return
26 end
27 local.get $gen
28 call $next
29 call $log
30 local.get $n
31 i32.const -1
32 i32.add
33 local.set $n
34 br $l
35 end
36 )
37 (func $interleave-naturals-and-fib (;9;) (type $func)
38 (local $gen1 i32) (local $gen2 i32)
39 ref.func $naturals
40 cont.new $cont
41 call $init
42 local.set $gen1
43 ref.func $fibonacci
44 cont.new $cont
45 call $init
46 local.set $gen2
47 i32.const 5
48 local.get $gen1
49 call $print-with-next
50 i32.const 5
51 local.get $gen2
52 call $print-with-next
53 i32.const 5
54 local.get $gen1
55 call $print-with-next
56 i32.const 5
57 local.get $gen2
58 call $print-with-next
59 i32.const 5
60 local.get $gen1
61 call $print-with-next
62 i32.const 5
63 local.get $gen2
64 call $print-with-next
65 i32.const 5
66 local.get $gen1
67 call $print-with-next
68 i32.const 5
69 local.get $gen2
70 call $print-with-next
71 )
72 (func $main (;10;) (type $func)
73 call $interleave-naturals-and-fib
74 i32.const 42
75 ref.func $naturals
76 cont.new $cont
77 call $print-first
78 i32.const 42
79 ref.func $fibonacci
80 cont.new $cont
81 call $print-first
82 i32.const 101
83 ref.func $naturals
84 cont.new $cont
85 call $sum-first
86 call $log
87 i32.const 10
88 ref.func $one-two-three
89 cont.new $cont
90 call $sum-first
91 call $log
92 )
93 )