package ocaml-base-compiler

  1. Overview
  2. Docs
On This Page
  1. Types
  2. Functions

Representation and manipulation of classes and class types.

Types

type class_element = Odoc_class.class_element =
  1. | Class_attribute of Value.t_attribute
  2. | Class_method of Value.t_method
  3. | Class_comment of text

To keep the order of elements in a class.

type cct = Odoc_class.cct =
  1. | Cl of t_class
  2. | 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 = {
  1. ic_name : Name.t;
    (*

    Complete name of the inherited class.

    *)
  2. mutable ic_class : cct option;
    (*

    The associated t_class or t_class_type.

    *)
  3. ic_text : text option;
    (*

    The inheritance description, if any.

    *)
}
and class_apply = Odoc_class.class_apply = {
  1. capp_name : Name.t;
    (*

    The complete name of the applied class.

    *)
  2. mutable capp_class : t_class option;
    (*

    The associated t_class if we found it.

    *)
  3. capp_params : Types.type_expr list;
    (*

    The type of expressions the class is applied to.

    *)
  4. capp_params_code : string list;
    (*

    The code of these exprssions.

    *)
}
and class_constr = Odoc_class.class_constr = {
  1. cco_name : Name.t;
    (*

    The complete name of the applied class.

    *)
  2. mutable cco_class : cct option;
    (*

    The associated class or class type if we found it.

    *)
  3. cco_type_parameters : Types.type_expr list;
    (*

    The type parameters of the class, if needed.

    *)
}
and class_kind = Odoc_class.class_kind =
  1. | Class_structure of inherited_class list * class_element list
    (*

    An explicit class structure, used in implementation and interface.

    *)
  2. | Class_apply of class_apply
    (*

    Application/alias of a class, used in implementation only.

    *)
  3. | 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

    *)
  4. | Class_constraint of class_kind * class_type_kind
    (*

    A class definition with a constraint.

    *)
and t_class = Odoc_class.t_class = {
  1. cl_name : Name.t;
    (*

    Complete name of the class.

    *)
  2. mutable cl_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. cl_type : Types.class_type;
    (*

    Type of the class.

    *)
  4. cl_type_parameters : Types.type_expr list;
    (*

    Type parameters.

    *)
  5. cl_virtual : bool;
    (*

    true when the class is virtual.

    *)
  6. mutable cl_kind : class_kind;
    (*

    The way the class is defined.

    *)
  7. mutable cl_parameters : Parameter.parameter list;
    (*

    The parameters of the class.

    *)
  8. mutable cl_loc : location;
}

Representation of a class.

and class_type_alias = Odoc_class.class_type_alias = {
  1. cta_name : Name.t;
    (*

    Complete name of the target class type.

    *)
  2. mutable cta_class : cct option;
    (*

    The target t_class or t_class_type, if we found it.

    *)
  3. cta_type_parameters : Types.type_expr list;
    (*

    The type parameters. FIXME : use strings?

    *)
}
and class_type_kind = Odoc_class.class_type_kind =
  1. | Class_signature of inherited_class list * class_element list
  2. | Class_type of class_type_alias
    (*

    A class type eventually applied to type args.

    *)
and t_class_type = Odoc_class.t_class_type = {
  1. clt_name : Name.t;
    (*

    Complete name of the type.

    *)
  2. mutable clt_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. clt_type : Types.class_type;
  4. clt_type_parameters : Types.type_expr list;
    (*

    Type parameters.

    *)
  5. clt_virtual : bool;
    (*

    true if the class type is virtual

    *)
  6. mutable clt_kind : class_type_kind;
    (*

    The way the class type is defined.

    *)
  7. 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.

val class_parameter_text_by_name : t_class -> string -> text option

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_comments : ?trans:bool -> t_class -> text list

Access to the comments 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.

OCaml

Innovation. Community. Security.