Skip to content

Commit 24eb152

Browse files
committed
Fix encoding and decoding of tag imports.
This patch brings the encoding and decoding of tag imports in sync with the exception handling proposal. Resolves #101.
1 parent 3ac42d8 commit 24eb152

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

interpreter/binary/decode.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ let import_desc s =
10871087
| 0x01 -> TableImport (table_type s)
10881088
| 0x02 -> MemoryImport (memory_type s)
10891089
| 0x03 -> GlobalImport (global_type s)
1090-
| 0x04 -> TagImport (at var s)
1090+
| 0x04 -> TagImport (tag_type s)
10911091
| _ -> error s (pos s - 1) "malformed import kind"
10921092

10931093
let import s =

interpreter/binary/encode.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ struct
951951
| TableImport t -> byte 0x01; table_type t
952952
| MemoryImport t -> byte 0x02; memory_type t
953953
| GlobalImport t -> byte 0x03; global_type t
954-
| TagImport t -> byte 0x04; var t
954+
| TagImport t -> byte 0x04; tag_type t
955955

956956
let import im =
957957
let {module_name; item_name; idesc} = im.it in
@@ -1002,8 +1002,8 @@ struct
10021002
section 6 (vec global) gs (gs <> [])
10031003

10041004
(* Tag section *)
1005-
let tag tag =
1006-
tag_type tag.it.tgtype
1005+
let tag (t : tag) =
1006+
byte 0x00; var t.it.tgtype
10071007

10081008
let tag_section ts =
10091009
section 13 (vec tag) ts (ts <> [])

0 commit comments

Comments
 (0)