• en

Module Typedtree

type partial =
| Partial
| Total
type optional =
| Required
| Optional
type attribute = Parsetree.attribute
type attributes = attribute list
type pattern = {
pat_desc : pattern_desc;
pat_loc : Location.t;
pat_extra : (pat_extra * Location.t * attributes) list;
pat_type : Types.type_expr;
pat_env : Env.t;
pat_attributes : attributes;
}
type pat_extra =
| Tpat_constraint of core_type
| Tpat_type of Path.t * Longident.t Asttypes.loc
| Tpat_unpack
type pattern_desc =
| Tpat_any
| Tpat_var of Ident.t * string Asttypes.loc
| Tpat_alias of pattern * Ident.t * string Asttypes.loc
| Tpat_constant of Asttypes.constant
| Tpat_tuple of pattern list
| Tpat_construct of Longident.t Asttypes.loc * Types.constructor_description * pattern list
| Tpat_variant of Asttypes.label * pattern option * Types.row_desc Pervasives.ref
| Tpat_record of (Longident.t Asttypes.loc * Types.label_description * pattern) list * Asttypes.closed_flag
| Tpat_array of pattern list
| Tpat_or of pattern * pattern * Types.row_desc option
| Tpat_lazy of pattern
type expression = {
exp_desc : expression_desc;
exp_loc : Location.t;
exp_extra : (exp_extra * Location.t * attributes) list;
exp_type : Types.type_expr;
exp_env : Env.t;
exp_attributes : attributes;
}
type exp_extra =
| Texp_constraint of core_type
| Texp_coerce of core_type option * core_type
| Texp_open of Asttypes.override_flag * Path.t * Longident.t Asttypes.loc * Env.t
| Texp_poly of core_type option
| Texp_newtype of string
type expression_desc =
| Texp_ident of Path.t * Longident.t Asttypes.loc * Types.value_description
| Texp_constant of Asttypes.constant
| Texp_let of Asttypes.rec_flag * value_binding list * expression
| Texp_function of Asttypes.label * case list * partial
| Texp_apply of expression * (Asttypes.label * expression option * optional) list
| Texp_match of expression * case list * case list * partial
| Texp_try of expression * case list
| Texp_tuple of expression list
| Texp_construct of Longident.t Asttypes.loc * Types.constructor_description * expression list
| Texp_variant of Asttypes.label * expression option
| Texp_record of (Longident.t Asttypes.loc * Types.label_description * expression) list * expression option
| Texp_field of expression * Longident.t Asttypes.loc * Types.label_description
| Texp_setfield of expression * Longident.t Asttypes.loc * Types.label_description * expression
| Texp_array of expression list
| Texp_ifthenelse of expression * expression * expression option
| Texp_sequence of expression * expression
| Texp_while of expression * expression
| Texp_for of Ident.t * Parsetree.pattern * expression * expression * Asttypes.direction_flag * expression
| Texp_send of expression * meth * expression option
| Texp_new of Path.t * Longident.t Asttypes.loc * Types.class_declaration
| Texp_instvar of Path.t * Path.t * string Asttypes.loc
| Texp_setinstvar of Path.t * Path.t * string Asttypes.loc * expression
| Texp_override of Path.t * (Path.t * string Asttypes.loc * expression) list
| Texp_letmodule of Ident.t * string Asttypes.loc * module_expr * expression
| Texp_assert of expression
| Texp_lazy of expression
| Texp_object of class_structure * string list
| Texp_pack of module_expr
type meth =
| Tmeth_name of string
| Tmeth_val of Ident.t
type case = {
c_lhs : pattern;
c_guard : expression option;
c_rhs : expression;
}
type class_expr = {
cl_desc : class_expr_desc;
cl_loc : Location.t;
cl_type : Types.class_type;
cl_env : Env.t;
cl_attributes : attributes;
}
type class_expr_desc =
| Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
| Tcl_structure of class_structure
| Tcl_fun of Asttypes.label * pattern * (Ident.t * string Asttypes.loc * expression) list * class_expr * partial
| Tcl_apply of class_expr * (Asttypes.label * expression option * optional) list
| Tcl_let of Asttypes.rec_flag * value_binding list * (Ident.t * string Asttypes.loc * expression) list * class_expr
| Tcl_constraint of class_expr * class_type option * string list * string list * Types.Concr.t
type class_structure = {
cstr_self : pattern;
cstr_fields : class_field list;
cstr_type : Types.class_signature;
cstr_meths : Ident.t Types.Meths.t;
}
type class_field = {
cf_desc : class_field_desc;
cf_loc : Location.t;
cf_attributes : attributes;
}
type class_field_kind =
| Tcfk_virtual of core_type
| Tcfk_concrete of Asttypes.override_flag * expression
type class_field_desc =
| Tcf_inherit of Asttypes.override_flag * class_expr * string option * (string * Ident.t) list * (string * Ident.t) list
| Tcf_val of string Asttypes.loc * Asttypes.mutable_flag * Ident.t * class_field_kind * bool
| Tcf_method of string Asttypes.loc * Asttypes.private_flag * class_field_kind
| Tcf_constraint of core_type * core_type
| Tcf_initializer of expression
| Tcf_attribute of attribute
type module_expr = {
mod_desc : module_expr_desc;
mod_loc : Location.t;
mod_type : Types.module_type;
mod_env : Env.t;
mod_attributes : attributes;
}
type module_type_constraint =
| Tmodtype_implicit
| Tmodtype_explicit of module_type
type module_expr_desc =
| Tmod_ident of Path.t * Longident.t Asttypes.loc
| Tmod_structure of structure
| Tmod_functor of Ident.t * string Asttypes.loc * module_type option * module_expr
| Tmod_apply of module_expr * module_expr * module_coercion
| Tmod_constraint of module_expr * Types.module_type * module_type_constraint * module_coercion
| Tmod_unpack of expression * Types.module_type
type structure = {
str_items : structure_item list;
str_type : Types.signature;
str_final_env : Env.t;
}
type structure_item = {
str_desc : structure_item_desc;
str_loc : Location.t;
str_env : Env.t;
}
type structure_item_desc =
| Tstr_eval of expression * attributes
| Tstr_value of Asttypes.rec_flag * value_binding list
| Tstr_primitive of value_description
| Tstr_type of type_declaration list
| Tstr_typext of type_extension
| Tstr_exception of extension_constructor
| Tstr_module of module_binding
| Tstr_recmodule of module_binding list
| Tstr_modtype of module_type_declaration
| Tstr_open of open_description
| Tstr_class of (class_declaration * string list * Asttypes.virtual_flag) list
| Tstr_class_type of (Ident.t * string Asttypes.loc * class_type_declaration) list
| Tstr_include of include_declaration
| Tstr_attribute of attribute
type module_binding = {
mb_id : Ident.t;
mb_name : string Asttypes.loc;
mb_expr : module_expr;
mb_attributes : attributes;
mb_loc : Location.t;
}
type value_binding = {
vb_pat : pattern;
vb_expr : expression;
vb_attributes : attributes;
vb_loc : Location.t;
}
type module_coercion =
| Tcoerce_none
| Tcoerce_structure of (int * module_coercion) list * (Ident.t * int * module_coercion) list
| Tcoerce_functor of module_coercion * module_coercion
| Tcoerce_primitive of Primitive.description
| Tcoerce_alias of Path.t * module_coercion
type module_type = {
mty_desc : module_type_desc;
mty_type : Types.module_type;
mty_env : Env.t;
mty_loc : Location.t;
mty_attributes : attributes;
}
type module_type_desc =
| Tmty_ident of Path.t * Longident.t Asttypes.loc
| Tmty_signature of signature
| Tmty_functor of Ident.t * string Asttypes.loc * module_type option * module_type
| Tmty_with of module_type * (Path.t * Longident.t Asttypes.loc * with_constraint) list
| Tmty_typeof of module_expr
| Tmty_alias of Path.t * Longident.t Asttypes.loc
type signature = {
sig_items : signature_item list;
sig_type : Types.signature;
sig_final_env : Env.t;
}
type signature_item = {
sig_desc : signature_item_desc;
sig_env : Env.t;
sig_loc : Location.t;
}
type signature_item_desc =
| Tsig_value of value_description
| Tsig_type of type_declaration list
| Tsig_typext of type_extension
| Tsig_exception of extension_constructor
| Tsig_module of module_declaration
| Tsig_recmodule of module_declaration list
| Tsig_modtype of module_type_declaration
| Tsig_open of open_description
| Tsig_include of include_description
| Tsig_class of class_description list
| Tsig_class_type of class_type_declaration list
| Tsig_attribute of attribute
type module_declaration = {
md_id : Ident.t;
md_name : string Asttypes.loc;
md_type : module_type;
md_attributes : attributes;
md_loc : Location.t;
}
type module_type_declaration = {
mtd_id : Ident.t;
mtd_name : string Asttypes.loc;
mtd_type : module_type option;
mtd_attributes : attributes;
mtd_loc : Location.t;
}
type open_description = {
open_path : Path.t;
open_txt : Longident.t Asttypes.loc;
open_override : Asttypes.override_flag;
open_loc : Location.t;
open_attributes : attribute list;
}
type 'a include_infos = {
incl_mod : 'a;
incl_type : Types.signature;
incl_loc : Location.t;
incl_attributes : attribute list;
}
type include_description = module_type include_infos
type include_declaration = module_expr include_infos
type with_constraint =
| Twith_type of type_declaration
| Twith_module of Path.t * Longident.t Asttypes.loc
| Twith_typesubst of type_declaration
| Twith_modsubst of Path.t * Longident.t Asttypes.loc
type core_type = {
ctyp_desc : core_type_desc;
ctyp_type : Types.type_expr;
ctyp_env : Env.t;
ctyp_loc : Location.t;
ctyp_attributes : attributes;
}
type core_type_desc =
| Ttyp_any
| Ttyp_var of string
| Ttyp_arrow of Asttypes.label * core_type * core_type
| Ttyp_tuple of core_type list
| Ttyp_constr of Path.t * Longident.t Asttypes.loc * core_type list
| Ttyp_object of (string * attributes * core_type) list * Asttypes.closed_flag
| Ttyp_class of Path.t * Longident.t Asttypes.loc * core_type list
| Ttyp_alias of core_type * string
| Ttyp_variant of row_field list * Asttypes.closed_flag * Asttypes.label list option
| Ttyp_poly of string list * core_type
| Ttyp_package of package_type
type package_type = {
pack_path : Path.t;
pack_fields : (Longident.t Asttypes.loc * core_type) list;
pack_type : Types.module_type;
pack_txt : Longident.t Asttypes.loc;
}
type row_field =
| Ttag of Asttypes.label * attributes * bool * core_type list
| Tinherit of core_type
type value_description = {
val_id : Ident.t;
val_name : string Asttypes.loc;
val_desc : core_type;
val_prim : string list;
val_loc : Location.t;
val_attributes : attributes;
}
type type_declaration = {
typ_id : Ident.t;
typ_name : string Asttypes.loc;
typ_params : (core_type * Asttypes.variance) list;
typ_cstrs : (core_type * core_type * Location.t) list;
typ_kind : type_kind;
typ_private : Asttypes.private_flag;
typ_manifest : core_type option;
typ_loc : Location.t;
typ_attributes : attributes;
}
type type_kind =
| Ttype_abstract
| Ttype_variant of constructor_declaration list
| Ttype_record of label_declaration list
| Ttype_open
type label_declaration = {
ld_id : Ident.t;
ld_name : string Asttypes.loc;
ld_mutable : Asttypes.mutable_flag;
ld_type : core_type;
ld_loc : Location.t;
ld_attributes : attributes;
}
type constructor_declaration = {
cd_id : Ident.t;
cd_name : string Asttypes.loc;
cd_args : core_type list;
cd_res : core_type option;
cd_loc : Location.t;
cd_attributes : attributes;
}
type type_extension = {
tyext_path : Path.t;
tyext_txt : Longident.t Asttypes.loc;
tyext_params : (core_type * Asttypes.variance) list;
tyext_constructors : extension_constructor list;
tyext_private : Asttypes.private_flag;
tyext_attributes : attributes;
}
type extension_constructor = {
ext_id : Ident.t;
ext_name : string Asttypes.loc;
ext_kind : extension_constructor_kind;
ext_loc : Location.t;
ext_attributes : attributes;
}
type extension_constructor_kind =
| Text_decl of core_type list * core_type option
| Text_rebind of Path.t * Longident.t Asttypes.loc
type class_type = {
cltyp_desc : class_type_desc;
cltyp_type : Types.class_type;
cltyp_env : Env.t;
cltyp_loc : Location.t;
cltyp_attributes : attributes;
}
type class_type_desc =
| Tcty_constr of Path.t * Longident.t Asttypes.loc * core_type list
| Tcty_signature of class_signature
| Tcty_arrow of Asttypes.label * core_type * class_type
type class_signature = {
csig_self : core_type;
csig_fields : class_type_field list;
csig_type : Types.class_signature;
}
type class_type_field = {
ctf_desc : class_type_field_desc;
ctf_loc : Location.t;
ctf_attributes : attributes;
}
type class_type_field_desc =
| Tctf_inherit of class_type
| Tctf_val of (string * Asttypes.mutable_flag * Asttypes.virtual_flag * core_type)
| Tctf_method of (string * Asttypes.private_flag * Asttypes.virtual_flag * core_type)
| Tctf_constraint of (core_type * core_type)
| Tctf_attribute of attribute
type class_declaration = class_expr class_infos
type class_description = class_type class_infos
type class_type_declaration = class_type class_infos
type 'a class_infos = {
ci_virt : Asttypes.virtual_flag;
ci_params : (core_type * Asttypes.variance) list;
ci_id_name : string Asttypes.loc;
ci_id_class : Ident.t;
ci_id_class_type : Ident.t;
ci_id_object : Ident.t;
ci_id_typesharp : Ident.t;
ci_expr : 'a;
ci_loc : Location.t;
ci_attributes : attributes;
}
val iter_pattern_desc : pattern -> unit -> pattern_desc -> unit
val map_pattern_desc : pattern -> pattern -> pattern_desc -> pattern_desc
val let_bound_idents : value_binding list -> Ident.t list
val rev_let_bound_idents : value_binding list -> Ident.t list
val let_bound_idents_with_loc : value_binding list -> (Ident.t * string Asttypes.loc) list
val alpha_pat : (Ident.t * Ident.t) list -> pattern -> pattern
val mknoloc : 'a -> 'a Asttypes.loc
val mkloc : 'a -> Location.t -> 'a Asttypes.loc
val pat_bound_idents : pattern -> (Ident.t * string Asttypes.loc) list