package ocaml-base-compiler
Representation and manipulation of classes and class types.
Types
type class_element = Odoc_class.class_element =
| Class_attribute of Value.t_attribute
| Class_method of Value.t_method
| Class_comment of text
To keep the order of elements in a class.
type cct = Odoc_class.cct =
| Cl of t_class
| Cltype of t_class_type * Types.type_expr list
(*Class type and type parameters.
*)
Used when we can reference a t_class or a t_class_type.
and inherited_class = Odoc_class.inherited_class = {
ic_name : Name.t;
(*Complete name of the inherited class.
*)mutable ic_class : cct option;
(*The associated t_class or t_class_type.
*)ic_text : text option;
(*The inheritance description, if any.
*)
}
and class_apply = Odoc_class.class_apply = {
capp_name : Name.t;
(*The complete name of the applied class.
*)mutable capp_class : t_class option;
(*The associated t_class if we found it.
*)capp_params : Types.type_expr list;
(*The type of expressions the class is applied to.
*)capp_params_code : string list;
(*The code of these expressions.
*)
}
and class_constr = Odoc_class.class_constr = {
cco_name : Name.t;
(*The complete name of the applied class.
*)mutable cco_class : cct option;
(*The associated class or class type if we found it.
*)cco_type_parameters : Types.type_expr list;
(*The type parameters of the class, if needed.
*)
}
and class_kind = Odoc_class.class_kind =
| Class_structure of inherited_class list * class_element list
(*An explicit class structure, used in implementation and interface.
*)| Class_apply of class_apply
(*Application/alias of a class, used in implementation only.
*)| Class_constr of class_constr
(*A class used to give the type of the defined class, instead of a structure, used in interface only. For example, it will be used with the name
*)M1.M2....bar
when the class foo is defined like this :class foo : int -> bar
| Class_constraint of class_kind * class_type_kind
(*A class definition with a constraint.
*)
and t_class = Odoc_class.t_class = {
cl_name : Name.t;
(*Complete name of the class.
*)mutable cl_info : info option;
(*Information found in the optional associated comment.
*)cl_type : Types.class_type;
(*Type of the class.
*)cl_type_parameters : Types.type_expr list;
(*Type parameters.
*)cl_virtual : bool;
(*
*)true
when the class is virtual.mutable cl_kind : class_kind;
(*The way the class is defined.
*)mutable cl_parameters : Parameter.parameter list;
(*The parameters of the class.
*)mutable cl_loc : location;
}
Representation of a class.
and class_type_alias = Odoc_class.class_type_alias = {
cta_name : Name.t;
(*Complete name of the target class type.
*)mutable cta_class : cct option;
(*The target t_class or t_class_type, if we found it.
*)cta_type_parameters : Types.type_expr list;
(*The type parameters. FIXME : use strings?
*)
}
and class_type_kind = Odoc_class.class_type_kind =
| Class_signature of inherited_class list * class_element list
| Class_type of class_type_alias
(*A class type eventually applied to type args.
*)
and t_class_type = Odoc_class.t_class_type = {
clt_name : Name.t;
(*Complete name of the type.
*)mutable clt_info : info option;
(*Information found in the optional associated comment.
*)clt_type : Types.class_type;
clt_type_parameters : Types.type_expr list;
(*Type parameters.
*)clt_virtual : bool;
(*
*)true
if the class type is virtualmutable clt_kind : class_type_kind;
(*The way the class type is defined.
*)mutable clt_loc : location;
}
Representation of a class type.
Functions
val class_elements : ?trans:bool -> t_class -> class_element list
Access to the elements of a class.
val class_attributes : ?trans:bool -> t_class -> Value.t_attribute list
Access to the list of class attributes.
Access to the description associated to the given class parameter name.
val class_methods : ?trans:bool -> t_class -> Value.t_method list
Access to the methods of a class.
val class_type_elements : ?trans:bool -> t_class_type -> class_element list
Access to the elements of a class type.
val class_type_attributes :
?trans:bool ->
t_class_type ->
Value.t_attribute list
Access to the list of class type attributes.
val class_type_parameter_text_by_name : t_class_type -> string -> text option
Access to the description associated to the given class type parameter name.
val class_type_methods : ?trans:bool -> t_class_type -> Value.t_method list
Access to the methods of a class type.
val class_type_comments : ?trans:bool -> t_class_type -> text list
Access to the comments of a class type.