Skip to content

Commit a9799d5

Browse files
committed
Emit try_table instruction
1 parent 88acffc commit a9799d5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

compiler/lib/wasm/wa_wat_output.ml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -478,16 +478,13 @@ let expression_or_instructions ctx st in_function =
478478
]
479479
| Try (ty, body, catches) ->
480480
[ List
481-
(Atom "try"
481+
(Atom "try_table"
482482
:: (block_type st ty
483-
@ List (Atom "do" :: instructions body)
484-
:: List.map
485-
~f:(fun (tag, i, ty) ->
486-
List
487-
(Atom "catch"
488-
:: index st.tag_names tag
489-
:: instruction (Wa_ast.Br (i + 1, Some (Pop ty)))))
490-
catches))
483+
@ List.map
484+
~f:(fun (tag, i, _ty) ->
485+
List [ Atom "catch"; index st.tag_names tag; Atom (string_of_int i) ])
486+
catches
487+
@ instructions body))
491488
]
492489
and instruction i =
493490
match i with

0 commit comments

Comments
 (0)