diff options
| author | Alasdair | 2019-02-01 22:09:37 +0000 |
|---|---|---|
| committer | Alasdair | 2019-02-01 22:09:37 +0000 |
| commit | 2f8dd66dcaec500561f8736c98bebf65938fa608 (patch) | |
| tree | 5f11a7b50d5992bf6e21cc3c6b1f98b1e8ff3080 /src | |
| parent | 3532bc0bbc9015de6d1734ecaf9240b389a5a1e7 (diff) | |
Fix missing typedef cases in OCaml output
Diffstat (limited to 'src')
| -rw-r--r-- | src/ocaml_backend.ml | 7 | ||||
| -rw-r--r-- | src/rewrites.ml | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml index 75887b4e..31c3e093 100644 --- a/src/ocaml_backend.ml +++ b/src/ocaml_backend.ml @@ -582,7 +582,7 @@ let ocaml_string_of_abbrev ctx id typq typ = let ocaml_string_of_variant ctx id typq cases = separate space [string "let"; ocaml_string_of id; string "_"; equals; string "\"VARIANT\""] -let ocaml_typedef ctx (TD_aux (td_aux, _)) = +let ocaml_typedef ctx (TD_aux (td_aux, (l, _))) = match td_aux with | TD_record (id, typq, fields, _) -> ((separate space [string "type"; ocaml_typquant typq; zencode ctx id; equals; lbrace] @@ -606,7 +606,10 @@ let ocaml_typedef ctx (TD_aux (td_aux, _)) = separate space [string "type"; ocaml_typquant typq; zencode ctx id; equals; ocaml_typ ctx typ] ^^ ocaml_def_end ^^ ocaml_string_of_abbrev ctx id typq typ - | _ -> failwith "Unsupported typedef" + | TD_abbrev _ -> + empty + | TD_bitfield _ -> + Reporting.unreachable l __POS__ "Bitfield should be re-written" let get_externs (Defs defs) = let extern_id (VS_aux (VS_val_spec (typschm, id, ext, _), _)) = diff --git a/src/rewrites.ml b/src/rewrites.ml index 67b6518f..f8146a72 100644 --- a/src/rewrites.ml +++ b/src/rewrites.ml @@ -2329,6 +2329,8 @@ let rewrite_type_def_typs rw_typ rw_typquant (TD_aux (td, annot)) = match td with | TD_abbrev (id, typq, A_aux (A_typ typ, l)) -> TD_aux (TD_abbrev (id, rw_typquant typq, A_aux (A_typ (rw_typ typ), l)), annot) + | TD_abbrev (id, typq, typ_arg) -> + TD_aux (TD_abbrev (id, rw_typquant typq, typ_arg), annot) | TD_record (id, typq, typ_ids, flag) -> TD_aux (TD_record (id, rw_typquant typq, List.map (fun (typ, id) -> (rw_typ typ, id)) typ_ids, flag), annot) | TD_variant (id, typq, tus, flag) -> |
