package rescriptdep

  1. Overview
  2. Docs

Module TypesSource

Representation of types and declarations

Types defines the representation of types and declarations (that is, the content of module signatures).

CMI files are made of marshalled types.

Sourcemodule Meths_cache : sig ... end
Sourcetype type_expr = {
  1. mutable desc : type_desc;
  2. mutable level : int;
  3. id : int;
}
Sourceand type_desc =
  1. | Tvar of string option
  2. | Tarrow of string * type_expr * type_expr * commutable
  3. | Ttuple of type_expr list
  4. | Tconstr of Path.t * type_expr list * abbrev_memo ref
  5. | Tobject of type_expr * (Path.t * type_expr list) option ref
  6. | Tfield of string * field_kind * type_expr * type_expr
  7. | Tnil
  8. | Tsubst of type_expr
  9. | Tvariant of row_desc
  10. | Tunivar of string option
  11. | Tpoly of type_expr * type_expr list
  12. | Tpackage of Path.t * string list * type_expr list
Sourceand row_desc = {
  1. row_fields : (string * row_field) list;
  2. row_more : type_expr;
  3. row_bound : unit;
  4. row_fixed : bool;
  5. row_closed : bool;
}
Sourceand row_field =
  1. | Rpresent of type_expr option
  2. | Reither of bool * type_expr list * bool * row_field option ref
  3. | Rabsent
Sourceand abbrev_memo =
  1. | Mnil
  2. | Mcons of Path.t * type_expr * type_expr * abbrev_memo
Sourceand field_kind =
  1. | Fvar of field_kind option ref
  2. | Fpresent
  3. | Fabsent
Sourceand commutable =
  1. | Cok
  2. | Cunknown
Sourcetype value_description = {
  1. val_type : type_expr;
  2. val_kind : value_kind;
  3. val_loc : unit;
  4. val_attributes : string;
}
Sourceand value_kind =
  1. | Val_reg
  2. | Val_prim of string
  3. | Val_ivar of mutable_flag * string
  4. | Val_self of (unit * type_expr) Meths_cache.t ref * unit * string list
  5. | Val_anc of (unit * type_expr) Meths_cache.t ref * string
  6. | Val_unbound
Sourceand mutable_flag =
  1. | Immutable
  2. | Mutable
Sourcetype type_declaration = {
  1. type_params : type_expr list;
  2. type_arity : int;
  3. type_kind : type_kind;
  4. type_private : private_flag;
  5. type_manifest : type_expr option;
  6. type_variance : (bool * bool) list;
  7. type_newtype_level : (int * int) option;
  8. type_loc : unit;
  9. type_attributes : string;
  10. type_immediate : bool;
  11. type_unboxed : unboxed_status;
}
Sourceand type_kind =
  1. | Type_abstract
  2. | Type_record of label_declaration list * record_representation
  3. | Type_variant of constructor_declaration list
  4. | Type_open
Sourceand record_representation =
  1. | Record_regular
  2. | Record_float
  3. | Record_unboxed
Sourceand label_declaration = {
  1. ld_id : string;
  2. ld_mutable : mutable_flag;
  3. ld_type : type_expr;
  4. ld_loc : unit;
  5. ld_attributes : string;
}
Sourceand constructor_declaration = {
  1. cd_id : string;
  2. cd_args : constructor_arguments;
  3. cd_res : type_expr option;
  4. cd_loc : unit;
  5. cd_attributes : string;
}
Sourceand constructor_arguments =
  1. | Cstr_tuple of type_expr list
  2. | Cstr_record of label_declaration list
Sourceand unboxed_status =
  1. | Unboxed
  2. | Boxed
Sourceand private_flag =
  1. | Private
  2. | Public
Sourcetype module_type = {
  1. mutable desc : module_type_desc;
  2. id : int;
}
Sourceand module_type_desc =
  1. | Tmty_ident of Path.t
  2. | Tmty_signature of signature
  3. | Tmty_functor of string * module_type option * module_type
  4. | Tmty_with of module_type * (Path.t * with_constraint) list
  5. | Tmty_typeof of module_expr
  6. | Tmty_alias of Path.t
Sourceand signature = signature_item list
Sourceand signature_item = {
  1. sig_desc : signature_item_desc;
  2. sig_env : unit;
  3. sig_loc : unit;
}
Sourceand signature_item_desc =
  1. | Tsig_value of string * value_description
  2. | Tsig_type of string * type_declaration * rec_status
  3. | Tsig_typext of type_extension
  4. | Tsig_exception of extension_constructor
  5. | Tsig_module of string * module_declaration
  6. | Tsig_recmodule of module_declaration list
  7. | Tsig_modtype of string * modtype_declaration
  8. | Tsig_open of unit
  9. | Tsig_include of unit
  10. | Tsig_class of unit
  11. | Tsig_class_type of unit
  12. | Tsig_attribute of unit
Sourceand module_declaration = {
  1. md_id : string;
  2. md_type : module_type;
  3. md_attributes : string;
  4. md_loc : unit;
}
Sourceand module_expr = {
  1. mod_desc : module_expr_desc;
  2. mod_loc : unit;
  3. mod_type : module_type;
  4. mod_env : unit;
  5. mod_attributes : string;
}
Sourceand module_expr_desc =
  1. | Tmod_ident of Path.t
  2. | Tmod_structure of structure
  3. | Tmod_functor of string * module_type option * module_expr
  4. | Tmod_apply of module_expr * module_expr * unit
  5. | Tmod_constraint of module_expr * module_type * unit * unit
  6. | Tmod_unpack of unit * module_type
Sourceand structure = structure_item list
Sourceand structure_item = {
  1. str_desc : structure_item_desc;
  2. str_loc : unit;
  3. str_env : unit;
}
Sourceand structure_item_desc =
  1. | Tstr_eval of unit
  2. | Tstr_value of rec_flag * unit list
  3. | Tstr_primitive of string * value_description
  4. | Tstr_type of rec_flag * type_declaration list
  5. | Tstr_typext of type_extension
  6. | Tstr_exception of extension_constructor
  7. | Tstr_module of module_binding
  8. | Tstr_recmodule of module_binding list
  9. | Tstr_modtype of string * modtype_declaration
  10. | Tstr_open of unit
  11. | Tstr_class of unit
  12. | Tstr_class_type of unit
  13. | Tstr_include of unit
  14. | Tstr_attribute of unit
Sourceand module_binding = {
  1. mb_id : string;
  2. mb_name : string;
  3. mb_expr : module_expr;
  4. mb_attributes : string;
  5. mb_loc : unit;
}
Sourceand modtype_declaration = {
  1. mtd_type : module_type option;
  2. mtd_attributes : string;
  3. mtd_loc : unit;
}
Sourceand rec_flag =
  1. | Nonrecursive
  2. | Recursive
Sourceand rec_status =
  1. | Trec_not
  2. | Trec_first
  3. | Trec_next
Sourceand with_constraint =
  1. | Twith_type of type_declaration
  2. | Twith_module of Path.t
  3. | Twith_typesubst of type_declaration
  4. | Twith_modsubst of Path.t
Sourceand type_extension = {
  1. tyext_path : Path.t;
  2. tyext_params : type_expr list;
  3. tyext_constructors : extension_constructor list;
  4. tyext_private : private_flag;
  5. tyext_attributes : string;
}
Sourceand extension_constructor = {
  1. ext_id : string;
  2. ext_name : string;
  3. ext_type : unit;
  4. ext_kind : extension_constructor_kind;
  5. ext_loc : unit;
  6. ext_attributes : string;
}
Sourceand extension_constructor_kind =
  1. | Text_decl of constructor_arguments * type_expr option
  2. | Text_rebind of Path.t
Sourcetype class_type = {
  1. cty_desc : class_type_desc;
  2. cty_type : type_expr;
  3. cty_path : Path.t;
  4. cty_loc : unit;
}
Sourceand class_type_desc =
  1. | Tcty_constr of Path.t * type_expr list
  2. | Tcty_signature of class_signature
  3. | Tcty_arrow of string * type_expr * class_type
Sourceand class_signature = {
  1. csig_self : type_expr;
  2. csig_fields : class_type_field list;
  3. csig_type : type_expr;
}
Sourceand class_type_field = {
  1. ctf_desc : class_type_field_desc;
  2. ctf_loc : unit;
}
Sourceand class_type_field_desc =
  1. | Tcf_val of string * mutable_flag * type_expr
  2. | Tcf_method of string * private_flag * type_expr
  3. | Tcf_constraint of type_expr * type_expr
  4. | Tcf_inher of class_signature