diff options
author | Leo White <leo@lpw25.net> | 2021-07-13 16:02:26 +0100 |
---|---|---|
committer | Leo White <leo@lpw25.net> | 2021-07-13 16:02:26 +0100 |
commit | 6e5b86355accef1a3340a40e03d7f5c760fcd31e (patch) | |
tree | ad0bc7056be799d6bcf1706fe476bd5240f836a6 /ocamldoc/odoc_print.ml | |
parent | caf5108506a8f9f469c8721706687a4325ac8063 (diff) | |
download | ocaml-6e5b86355accef1a3340a40e03d7f5c760fcd31e.tar.gz |
Change representation of class types
Previously, class types represented their methods via the csig_self
field. This was a type_expr that was restricted to be syntactically
a Tobject node. With this patch the methods are represented directly
with a methods table. csig_self is no longer restricted to be
a Tobject node and is no longer required to contain the private methods.
We also add a csig_self_row field to hold the row variable of the class
type -- which means we can avoid going through csig_self to find it.
Diffstat (limited to 'ocamldoc/odoc_print.ml')
-rw-r--r-- | ocamldoc/odoc_print.ml | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/ocamldoc/odoc_print.ml b/ocamldoc/odoc_print.ml index 273522e98c..1c51d57425 100644 --- a/ocamldoc/odoc_print.ml +++ b/ocamldoc/odoc_print.ml @@ -87,23 +87,22 @@ let simpl_class_type t = | Cty_signature cs -> (* we delete vals and methods in order to not print them when displaying the type *) + let self_row = + Transient_expr.create Tnil + ~level:0 ~scope:Btype.lowest_level ~id:0 + in let tself = let t = cs.csig_self in - let t' = Transient_expr.create Tnil - ~level:0 ~scope:Btype.lowest_level ~id:0 in - let desc = - Tobject (Transient_expr.type_expr t', ref None) in + let desc = Tobject (Transient_expr.type_expr self_row, ref None) in Transient_expr.create desc - ~level:(get_level t) - ~scope:(get_scope t) - ~id:(get_id t) + ~level:(get_level t) ~scope:(get_scope t) ~id:(get_id t) in - Cty_signature { csig_self = Transient_expr.type_expr tself; + Types.Cty_signature { csig_self = Transient_expr.type_expr tself; + csig_self_row = Transient_expr.type_expr self_row; csig_vars = Vars.empty ; - csig_concr = Concr.empty ; - csig_inher = [] - } - | Cty_arrow (l, texp, ct) -> + csig_meths = Meths.empty ; + csig_inher = []; } + | Types.Cty_arrow (l, texp, ct) -> let new_ct = iter ct in Cty_arrow (l, texp, new_ct) in |