Skip to content

Commit

Permalink
Fix br empty argument
Browse files Browse the repository at this point in the history
  • Loading branch information
chambart committed Oct 7, 2024
1 parent d69dbb9 commit a99e41e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wasm/wat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ module C = struct

let tuple_make fields =
match fields with
| [] -> atom "_____ishouldnotexist"
(* assert false *)
| [] -> assert false
| [ field ] -> field
| fields ->
node "tuple.make" (Atom (List.length fields |> string_of_int) :: fields )
Expand Down Expand Up @@ -318,7 +317,10 @@ module C = struct
nodehv "loop" [ !$(Block_id.name id); results result ] body

let br id args =
node "br" [ !$(Block_id.name id); tuple_make args ]
match args with
| [] -> node "br" [ !$(Block_id.name id)]
| [arg] -> node "br" [ !$(Block_id.name id); arg ]
| _ -> node "br" [ !$(Block_id.name id); tuple_make args ]

let br' id = node "br" [ !$(Block_id.name id) ]

Expand Down

0 comments on commit a99e41e

Please sign in to comment.