summaryrefslogtreecommitdiff
path: root/test/interp/nested-if.txt
blob: 261b03ee32278298881e7bba7591b769dd9396a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;;; TOOL: run-interp

;; This used to test an odd case where a nested if would return a void, so the
;; true branch of the outer if would have to be dropped its instructions had
;; already been generated. Now that drops are explicit, this case is
;; straightforward.

(module
  (export "f" $f)
  (func $f (result i32)
    (block $exit
      (if                     ;; outer if
        (i32.const 1)
        (drop (i32.const 2))
        (if                   ;; inner if
          (i32.const 3)
          (br $exit))))
    (i32.const 4)))
(;; STDOUT ;;;
f() => i32:4
;;; STDOUT ;;)