diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2021-09-14 21:20:58 +0200 |
---|---|---|
committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2021-09-15 09:37:45 +0200 |
commit | 8420375777e2354c3169dc0414d9fccbb04579ad (patch) | |
tree | 8e96f98ab95d26763b07cbadb0a6cabe6171d2b8 /typing/printtyp.ml | |
parent | e20fe18de4aa9632a8f872ae8347959846d40235 (diff) | |
download | ocaml-8420375777e2354c3169dc0414d9fccbb04579ad.tar.gz |
[refactoring] Outcometree: introduce a record type for constructors
Diffstat (limited to 'typing/printtyp.ml')
-rw-r--r-- | typing/printtyp.ml | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/typing/printtyp.ml b/typing/printtyp.ml index 54da5fc543..9b0d227304 100644 --- a/typing/printtyp.ml +++ b/typing/printtyp.ml @@ -1421,12 +1421,20 @@ and tree_of_constructor cd = let name = Ident.name cd.cd_id in let arg () = tree_of_constructor_arguments cd.cd_args in match cd.cd_res with - | None -> (name, arg (), None) + | None -> { + ocstr_name = name; + ocstr_args = arg (); + ocstr_return_type = None; + } | Some res -> Names.with_local_names (fun () -> let ret = tree_of_typexp Type res in let args = arg () in - (name, args, Some ret)) + { + ocstr_name = name; + ocstr_args = args; + ocstr_return_type = Some ret; + }) and tree_of_label l = (Ident.name l.ld_id, l.ld_mutable = Mutable, tree_of_typexp Type l.ld_type) @@ -1511,7 +1519,11 @@ let extension_only_constructor id ppf ext = ext.ext_ret_type in Format.fprintf ppf "@[<hv>%a@]" - !Oprint.out_constr (name, args, ret) + !Oprint.out_constr { + ocstr_name = name; + ocstr_args = args; + ocstr_return_type = ret; + } (* Print a value declaration *) |