@@ -10,7 +10,7 @@ type 'a limits = {min : 'a; max : 'a option}
10
10
type mutability = Immutable | Mutable
11
11
type table_type = TableType of Int32 .t limits * ref_type
12
12
type memory_type = MemoryType of Int32 .t limits
13
- type event_type = func_type
13
+ type event_type = EventType of func_type
14
14
type global_type = GlobalType of value_type * mutability
15
15
type extern_type =
16
16
| ExternFuncType of func_type
@@ -51,10 +51,10 @@ let tables =
51
51
Lib.List. map_filter (function ExternTableType t -> Some t | _ -> None )
52
52
let memories =
53
53
Lib.List. map_filter (function ExternMemoryType t -> Some t | _ -> None )
54
- let events =
55
- Lib.List. map_filter (function ExternEventType t -> Some t | _ -> None )
56
54
let globals =
57
55
Lib.List. map_filter (function ExternGlobalType t -> Some t | _ -> None )
56
+ let events =
57
+ Lib.List. map_filter (function ExternEventType t -> Some t | _ -> None )
58
58
59
59
60
60
(* Subtyping *)
@@ -78,13 +78,16 @@ let match_memory_type (MemoryType lim1) (MemoryType lim2) =
78
78
let match_global_type gt1 gt2 =
79
79
gt1 = gt2
80
80
81
+ let match_event_type (EventType et1 ) (EventType et2 ) =
82
+ match_func_type et1 et2
83
+
81
84
let match_extern_type et1 et2 =
82
85
match et1, et2 with
83
- | ExternFuncType ft1, ExternFuncType ft2
84
- | ExternEventType ft1 , ExternEventType ft2 -> match_func_type ft1 ft2
86
+ | ExternFuncType ft1 , ExternFuncType ft2 -> match_func_type ft1 ft2
85
87
| ExternTableType tt1 , ExternTableType tt2 -> match_table_type tt1 tt2
86
88
| ExternMemoryType mt1 , ExternMemoryType mt2 -> match_memory_type mt1 mt2
87
89
| ExternGlobalType gt1 , ExternGlobalType gt2 -> match_global_type gt1 gt2
90
+ | ExternEventType et1 , ExternEventType et2 -> match_event_type et1 et2
88
91
| _ , _ -> false
89
92
90
93
@@ -133,9 +136,12 @@ let string_of_stack_type ts =
133
136
let string_of_func_type (FuncType (ins , out )) =
134
137
string_of_stack_type ins ^ " -> " ^ string_of_stack_type out
135
138
139
+ let string_of_event_type (EventType et ) =
140
+ string_of_func_type et
141
+
136
142
let string_of_extern_type = function
137
143
| ExternFuncType ft -> " func " ^ string_of_func_type ft
138
144
| ExternTableType tt -> " table " ^ string_of_table_type tt
139
145
| ExternMemoryType mt -> " memory " ^ string_of_memory_type mt
140
- | ExternEventType et -> " event " ^ string_of_func_type et
141
146
| ExternGlobalType gt -> " global " ^ string_of_global_type gt
147
+ | ExternEventType et -> " event " ^ string_of_event_type et
0 commit comments