blob: 9c72c4a1c00bdf96b6e7fe5015b771a0b0c3a4f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
;;; TOOL: run-interp
(module
(export "loop" $loop)
(func $loop (result i32)
(local i32 i32)
;; loop statements now require an explicit branch to the top
(loop $cont
(set_local 1 (i32.add (get_local 1) (get_local 0)))
(set_local 0 (i32.add (get_local 0) (i32.const 1)))
(if (i32.lt_s (get_local 0) (i32.const 5))
(br $cont)))
(get_local 1)))
(;; STDOUT ;;;
loop() => i32:10
;;; STDOUT ;;)
|