File: return_call_eh.wast

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (32 lines) | stat: -rw-r--r-- 639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; Test the combination of 'return_call' with exception handling.

(module
  (tag $t)

  (func $test (export "test") (result i32)
    (block $catch
      (return
        (try_table (result i32) (catch_all $catch)
          (call $return-call-in-try_table)
        )
      )
    )
    ;; Catch the exception thrown from $return-callee.
    (i32.const 42)
  )

  (func $return-call-in-try_table (result i32)
    (block $catch
      (try_table (catch_all $catch)
        (return_call $return-callee)
      )
    )
    (unreachable)
  )

  (func $return-callee (result i32)
    (throw $t)
  )
)

(assert_return (invoke "test") (i32.const 42))