@@ -53,6 +53,11 @@ let get_class_field_desc_infos = function
5353 | Typedtree. Tcf_method (str_loc , _ , _ ) -> Some (str_loc, `Method )
5454 | _ -> None
5555
56+ let get_class_signature_field_desc_infos = function
57+ | Typedtree. Tctf_val (outline_name , _ , _ , _ ) -> Some (outline_name, `Value )
58+ | Typedtree. Tctf_method (outline_name , _ , _ , _ ) -> Some (outline_name, `Method )
59+ | _ -> None
60+
5661let outline_type ~env typ =
5762 let ppf, to_string = Format. to_string () in
5863 Printtyp. wrap_printing_env env (fun () ->
@@ -141,6 +146,13 @@ let rec summarize node =
141146 in
142147 let deprecated = Type_utils. is_deprecated cd.ci_attributes in
143148 Some (mk ~children ~location `Class None cd.ci_id_class_type ~deprecated )
149+ | Class_type_declaration ctd ->
150+ let children =
151+ List. concat_map (Lazy. force node.t_children) ~f: get_class_elements
152+ in
153+ let deprecated = Type_utils. is_deprecated ctd.ci_attributes in
154+ Some
155+ (mk ~children ~location `ClassType None ctd.ci_id_class_type ~deprecated )
144156 | _ -> None
145157
146158and get_class_elements node =
@@ -151,20 +163,31 @@ and get_class_elements node =
151163 List. filter_map (Lazy. force node.t_children) ~f: (fun child ->
152164 match child.t_node with
153165 | Class_field cf -> begin
154- match get_class_field_desc_infos cf.cf_desc with
155- | Some (str_loc , outline_kind ) ->
156- let deprecated = Type_utils. is_deprecated cf.cf_attributes in
157- Some
158- { Query_protocol. outline_name = str_loc.Location. txt;
159- outline_kind;
160- outline_type = None ;
161- location = str_loc.Location. loc;
162- children = [] ;
163- deprecated
164- }
165- | None -> None
166+ cf.cf_desc |> get_class_field_desc_infos
167+ |> Option. map ~f: (fun (str_loc , outline_kind ) ->
168+ let deprecated = Type_utils. is_deprecated cf.cf_attributes in
169+ { Query_protocol. outline_name = str_loc.Location. txt;
170+ outline_kind;
171+ outline_type = None ;
172+ location = str_loc.Location. loc;
173+ children = [] ;
174+ deprecated
175+ })
166176 end
167177 | _ -> None )
178+ | Class_type { cltyp_desc = Tcty_signature { csig_fields; _ } ; _ } ->
179+ List. filter_map csig_fields ~f: (fun field ->
180+ get_class_signature_field_desc_infos field.ctf_desc
181+ |> Option. map ~f: (fun (name , outline_kind ) ->
182+ let deprecated = Type_utils. is_deprecated field.ctf_attributes in
183+ { Query_protocol. outline_name = name;
184+ outline_kind;
185+ outline_type = None ;
186+ location = field.ctf_loc;
187+ (* TODO: could we have more precised location information? *)
188+ children = [] ;
189+ deprecated
190+ }))
168191 | _ -> []
169192
170193and get_mod_children node =
0 commit comments