Skip to content

Commit

Permalink
Sub declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
chambart committed Oct 7, 2024
1 parent f7a76ba commit 9441d3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wasm/emit_wat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2362,7 +2362,7 @@ module ToWasm = struct
| Array { sub; fields } ->
let descr = C.array_type fields in
let descr =
match sub with None -> descr | Some sub -> C.sub sub descr
C.sub sub descr
in
C.type_ name descr
| Func { params; results } -> C.type_ name (C.func_type params results)
Expand Down
6 changes: 4 additions & 2 deletions wasm/wat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ module C = struct
let struct_type ~sub fields =
let descr = node "struct" (List.map field fields) in
match sub with
| None -> descr
| None -> node "sub" [ descr ]
| Some name -> node "sub" [ type_name name; descr ]

let array_type f = node "array" [ node "mut" [ type_atom f ] ]
Expand Down Expand Up @@ -351,7 +351,9 @@ module C = struct
]

let sub name descr =
node "sub" [ type_name name; descr ]
match name with
| None -> node "sub" [ descr ]
| Some name -> node "sub" [ type_name name; descr ]

let opt_tuple fields =
[ tuple_make fields ]
Expand Down

0 comments on commit 9441d3b

Please sign in to comment.