blob: 6e0ca905549133ecc0d8be75bbd9e916bd8b15b9 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
(module
(event $e0 (attr 0) (param i32))
(event $e1 (attr 0) (param i32 f32))
(func (export "throw_test")
(throw $e0 (i32.const 0))
)
(func (export "rethrow_test")
(rethrow (ref.null))
)
(func (export "try_test") (result i32)
(try (result i32)
(i32.const 3)
(catch
(drop (exnref.pop))
(i32.const 3)
)
)
)
(func (export "br_on_exn_test") (result i32)
(block $l0 (result i32)
(drop
(br_on_exn $l0 $e0 (ref.null))
)
(i32.const 0)
)
)
)
(assert_trap (invoke "throw_test"))
(assert_trap (invoke "rethrow_test"))
(assert_return (invoke "try_test") (i32.const 3))
(assert_trap (invoke "br_on_exn_test"))
(assert_invalid
(module
(func $f0
(try
(nop)
(catch (i32.const 0))
)
)
)
"try's body type must match catch's body type"
)
(assert_invalid
(module
(func $f0
(try
(i32.const 0)
(catch (i32.const 0))
)
)
)
"try's type does not match try body's type"
)
(assert_invalid
(module
(event $e0 (attr 0) (param i32))
(func $f0
(throw $e0 (f32.const 0))
)
)
"event param types must match"
)
(assert_invalid
(module
(event $e0 (attr 0) (param i32 f32))
(func $f0
(throw $e0 (f32.const 0))
)
)
"event's param numbers must match"
)
(assert_invalid
(module
(func $f0
(rethrow (i32.const 0))
)
)
"rethrow's argument must be exnref type"
)
(assert_invalid
(module
(event $e0 (attr 0) (param i32))
(func $f0 (result i32)
(block $l0 (result i32)
(drop
(br_on_exn $l0 $e0 (i32.const 0))
)
(i32.const 0)
)
)
)
"br_on_exn's argument must be unreachable or exnref type"
)
(assert_invalid
(module
(event $e0 (attr 0) (param i32))
(func $f0 (result i32) (local $0 exnref)
(block $l0 (result i32)
(i32.eqz
(br_on_exn $l0 $e0 (local.get $0))
)
)
)
)
"i32.eqz input must be i32"
)
(assert_invalid
(module
(event $e0 (attr 0) (param i32))
(func $f0 (result f32) (local $0 exnref)
(block $l0 (result f32)
(drop
(br_on_exn $l0 $e0 (local.get $0))
)
(f32.const 0)
)
)
)
"block+breaks must have right type if breaks return a value"
)
|