package rescriptdep

  1. Overview
  2. Docs

Module TypedtreeSource

Abstract syntax tree after typing

By comparison with Parsetree:

  • Every Longindent.t is accompanied by a resolved Path.t.
Sourcetype pattern = {
  1. pat_desc : pattern_desc;
  2. pat_loc : Location.t;
  3. pat_extra : (pat_extra * Location.t * string) list;
  4. pat_type : Types.type_expr;
  5. mutable pat_env : unit;
  6. pat_attributes : string;
}
Sourceand pat_extra =
  1. | Tpat_constraint of core_type
  2. | Tpat_type of Path.t * string
  3. | Tpat_unpack
  4. | Tpat_open of Path.t * unit
Sourceand pattern_desc =
  1. | Tpat_any
  2. | Tpat_var of Ident.t * string Asttypes.loc
  3. | Tpat_alias of pattern * string * string
  4. | Tpat_constant of constant
  5. | Tpat_tuple of pattern list
  6. | Tpat_construct of unit * constructor_description * pattern list
  7. | Tpat_variant of string * pattern option * Types.row_desc ref
  8. | Tpat_record of (unit * label_description * pattern) list * closed_flag
  9. | Tpat_array of pattern list
  10. | Tpat_or of pattern * pattern * Types.row_desc option
  11. | Tpat_lazy of pattern
Sourceand expression = {
  1. exp_desc : expression_desc;
  2. exp_loc : Location.t;
  3. exp_extra : (exp_extra * Location.t * string) list;
  4. exp_type : Types.type_expr;
  5. exp_env : unit;
  6. exp_attributes : string;
}
Sourceand exp_extra =
  1. | Texp_constraint of core_type
  2. | Texp_coerce of core_type option * core_type
  3. | Texp_open of override_flag * Path.t * unit * unit
  4. | Texp_poly of core_type option
  5. | Texp_newtype of string
Sourceand expression_desc =
  1. | Texp_ident of Path.t * unit * value_description
  2. | Texp_constant of constant
  3. | Texp_let of Types.rec_flag * value_binding list * expression
  4. | Texp_function of {
    1. arg_label : string;
    2. param : unit;
    3. cases : case list;
    4. partial : partial;
    }
  5. | Texp_apply of expression * (string * expression option) list
  6. | Texp_match of expression * case list * case list * partial
  7. | Texp_try of expression * case list
  8. | Texp_tuple of expression list
  9. | Texp_construct of Location.t * constructor_description * expression list
  10. | Texp_variant of string * expression option
  11. | Texp_record of {
    1. fields : (label_description * record_label_definition) array;
    2. representation : Types.record_representation;
    3. extended_expression : expression option;
    }
  12. | Texp_field of expression * Location.t * label_description
  13. | Texp_setfield of expression * Location.t * label_description * expression
  14. | Texp_array of expression list
  15. | Texp_ifthenelse of expression * expression * expression option
  16. | Texp_sequence of expression * expression
  17. | Texp_while of expression * expression
  18. | Texp_for of unit * string * expression * expression * direction_flag * expression
  19. | Texp_send of expression * meth * expression option
  20. | Texp_new of Path.t * unit * class_declaration
  21. | Texp_instvar of Path.t * Path.t * string
  22. | Texp_setinstvar of Path.t * Path.t * string * expression
  23. | Texp_override of Path.t * (Path.t * string * expression) list
  24. | Texp_letmodule of unit * string * module_expr * expression
  25. | Texp_letexception of extension_constructor * expression
  26. | Texp_assert of expression
  27. | Texp_lazy of expression
  28. | Texp_object of class_structure * string list
  29. | Texp_pack of module_expr
  30. | Texp_letop of {
    1. let_ : binding_op;
    2. ands : binding_op list;
    3. body : case;
    }
  31. | Texp_unreachable
  32. | Texp_extension_constructor of Location.t * Path.t
  33. | Texp_open of open_declaration * expression
Sourceand meth =
  1. | Tmeth_name of string
  2. | Tmeth_val of Ident.t
Sourceand case = {
  1. c_lhs : pattern;
  2. c_guard : expression option;
  3. c_rhs : expression;
}
Sourceand record_label_definition =
  1. | Kept of Types.type_expr
  2. | Overridden of Location.t * expression
Sourceand binding_op = {
  1. bop_op_path : Path.t;
  2. bop_op_val : value_description;
  3. bop_op_type : Types.type_expr;
  4. bop_exp : expression;
  5. bop_loc : Location.t;
}
Sourceand value_binding = {
  1. vb_pat : pattern;
  2. vb_expr : expression;
  3. vb_attributes : string;
  4. vb_loc : Location.t;
}
Sourceand module_binding = {
  1. mb_id : Ident.t;
  2. mb_name : string Asttypes.loc;
  3. mb_expr : module_expr;
  4. mb_attributes : string;
  5. mb_loc : Location.t;
}
Sourceand module_coercion =
  1. | Tcoerce_none
  2. | Tcoerce_structure of (int * module_coercion) list
  3. | Tcoerce_functor of module_coercion * module_coercion
  4. | Tcoerce_primitive of unit
  5. | Tcoerce_alias of Path.t * module_coercion
Sourceand module_type = {
  1. mty_desc : module_type_desc;
  2. mty_type : Types.module_type;
  3. mty_env : unit;
  4. mty_loc : Location.t;
  5. mty_attributes : string;
}
Sourceand module_type_desc =
  1. | Tmty_ident of Path.t * unit
  2. | Tmty_signature of signature
  3. | Tmty_functor of unit * string * module_type option * module_type
  4. | Tmty_with of module_type * (Path.t * Location.t * with_constraint) list
  5. | Tmty_typeof of module_expr
  6. | Tmty_alias of Path.t * unit
Sourceand signature = {
  1. sig_items : signature_item list;
  2. sig_type : Types.signature;
  3. sig_final_env : unit;
}
Sourceand signature_item = {
  1. sig_desc : signature_item_desc;
  2. sig_env : unit;
  3. sig_loc : Location.t;
}
Sourceand signature_item_desc =
  1. | Tsig_value of string * value_description
  2. | Tsig_type of Types.rec_flag * type_declaration list
  3. | Tsig_typesubst of type_declaration list
  4. | Tsig_typext of type_extension
  5. | Tsig_exception of extension_constructor
  6. | Tsig_module of string * module_declaration
  7. | Tsig_recmodule of module_declaration list
  8. | Tsig_modtype of string * Types.modtype_declaration
  9. | Tsig_modtypesubst of string * Types.modtype_declaration
  10. | Tsig_open of open_description
  11. | Tsig_include of include_description
  12. | Tsig_class of class_description list
  13. | Tsig_class_type of class_type_declaration list
  14. | Tsig_attribute of string
Sourceand module_declaration = {
  1. md_id : Ident.t;
  2. md_name : string Asttypes.loc;
  3. md_type : module_type;
  4. md_attributes : string;
  5. md_loc : Location.t;
}
Sourceand module_expr = {
  1. mod_desc : module_expr_desc;
  2. mod_loc : Location.t;
  3. mod_type : Types.module_type;
  4. mod_env : unit;
  5. mod_attributes : string;
}
Sourceand module_expr_desc =
  1. | Tmod_ident of Path.t * unit
  2. | Tmod_structure of structure
  3. | Tmod_functor of unit * string * module_type option * module_expr
  4. | Tmod_apply of module_expr * module_expr * module_coercion
  5. | Tmod_constraint of module_expr * Types.module_type * module_type_constraint * module_coercion
  6. | Tmod_unpack of expression * Types.module_type
Sourceand structure = {
  1. str_items : structure_item list;
  2. str_type : Types.signature;
  3. str_final_env : unit;
}
Sourceand structure_item = {
  1. str_desc : structure_item_desc;
  2. str_loc : Location.t;
  3. str_env : unit;
}
Sourceand structure_item_desc =
  1. | Tstr_eval of expression * string
  2. | Tstr_value of Types.rec_flag * value_binding list
  3. | Tstr_primitive of value_description
  4. | Tstr_type of Types.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 module_type_declaration
  10. | Tstr_open of open_declaration
  11. | Tstr_class of class_declaration list * string list
  12. | Tstr_class_type of class_type_declaration list * string list
  13. | Tstr_include of include_declaration
  14. | Tstr_attribute of string
Sourceand module_type_declaration = {
  1. mtd_id : Ident.t;
  2. mtd_name : string Asttypes.loc;
  3. mtd_type : module_type option;
  4. mtd_attributes : string;
  5. mtd_loc : Location.t;
}
Sourceand open_declaration = {
  1. open_expr : module_expr;
  2. open_bound_items : Types.signature;
  3. open_override : override_flag;
  4. open_env : unit;
  5. open_loc : Location.t;
  6. open_attributes : string;
}
Sourceand open_description = {
  1. open_path : Path.t;
  2. open_txt : Longident.t Asttypes.loc;
  3. open_override : override_flag;
  4. open_loc : Location.t;
  5. open_attributes : string;
}
Sourceand include_declaration = {
  1. incl_mod : module_expr;
  2. incl_type : Types.signature;
  3. incl_loc : unit;
  4. incl_attributes : string;
}
Sourceand include_description = {
  1. incl_mod : module_type;
  2. incl_type : Types.signature;
  3. incl_loc : Location.t;
  4. incl_attributes : string;
}
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 core_type = {
  1. ctyp_desc : core_type_desc;
  2. ctyp_type : Types.type_expr;
  3. ctyp_env : unit;
  4. ctyp_loc : Location.t;
  5. ctyp_attributes : string;
}
Sourceand core_type_desc =
  1. | Ttyp_var of string
  2. | Ttyp_any
  3. | Ttyp_poly of string list * core_type
  4. | Ttyp_constr of Path.t * unit * core_type list
  5. | Ttyp_arrow of string * core_type * core_type
  6. | Ttyp_tuple of core_type list
  7. | Ttyp_object of unit * closed_flag
  8. | Ttyp_class of Path.t * unit * core_type list
  9. | Ttyp_alias of core_type * string
  10. | Ttyp_variant of row_field list * closed_flag * string list option
  11. | Ttyp_package of package_type
Sourceand value_description = {
  1. val_id : Ident.t;
  2. val_name : string Asttypes.loc;
  3. val_desc : core_type;
  4. val_val : Types.value_description;
  5. val_prim : string list;
  6. val_loc : Location.t;
  7. val_attributes : string;
}
Sourceand type_declaration = {
  1. typ_id : Ident.t;
  2. typ_name : string Asttypes.loc;
  3. typ_params : (core_type * unit) list;
  4. typ_type : Types.type_declaration;
  5. typ_cstrs : unit;
  6. typ_kind : type_kind;
  7. typ_private : private_flag;
  8. typ_manifest : core_type option;
  9. typ_loc : Location.t;
  10. typ_attributes : string;
}
Sourceand type_kind =
  1. | Ttype_abstract
  2. | Ttype_variant of constructor_declaration list
  3. | Ttype_record of label_declaration list
  4. | Ttype_open
Sourceand label_declaration = {
  1. ld_id : Ident.t;
  2. ld_name : string Asttypes.loc;
  3. ld_mutable : Types.mutable_flag;
  4. ld_type : core_type;
  5. ld_loc : Location.t;
  6. ld_attributes : string;
}
Sourceand constructor_declaration = {
  1. cd_id : Ident.t;
  2. cd_name : string Asttypes.loc;
  3. cd_args : constructor_arguments;
  4. cd_res : core_type option;
  5. cd_loc : Location.t;
  6. cd_attributes : string;
}
Sourceand constructor_arguments =
  1. | Cstr_tuple of core_type list
  2. | Cstr_record of label_declaration list
Sourceand type_extension = {
  1. tyext_path : Path.t;
  2. tyext_txt : Longident.t Asttypes.loc;
  3. tyext_params : (core_type * unit) list;
  4. tyext_constructors : extension_constructor list;
  5. tyext_private : private_flag;
  6. tyext_loc : Location.t;
  7. tyext_attributes : string;
}
Sourceand extension_constructor = {
  1. ext_id : Ident.t;
  2. ext_name : string Asttypes.loc;
  3. ext_type : Types.extension_constructor;
  4. ext_kind : extension_constructor_kind;
  5. ext_loc : Location.t;
  6. ext_attributes : string;
}
Sourceand extension_constructor_kind =
  1. | Text_decl of constructor_arguments * core_type option
  2. | Text_rebind of Path.t * unit
Sourceand class_declaration = unit
Sourceand class_description = unit
Sourceand class_type_declaration = unit
Sourceand class_structure = {
  1. cstr_self : pattern;
  2. cstr_fields : class_field list;
  3. cstr_type : Types.class_signature;
  4. cstr_meths : unit;
}
Sourceand class_field = {
  1. cf_desc : class_field_desc;
  2. cf_loc : Location.t;
  3. cf_attributes : string;
}
Sourceand class_field_kind =
  1. | Tcfk_val of unit * Types.mutable_flag * unit * expression
  2. | Tcfk_method of unit * private_flag * unit * expression
  3. | Tcfk_initializer of expression
  4. | Tcfk_constraint of core_type * core_type
Sourceand class_field_desc =
  1. | Tcf_inherit of override_flag * class_expr * string option * unit * unit
  2. | Tcf_val of string * string * Types.mutable_flag * class_field_kind
  3. | Tcf_method of string * string * private_flag * class_field_kind
  4. | Tcf_constraint of core_type * core_type
  5. | Tcf_initializer of expression
  6. | Tcf_attribute of string
Sourceand class_expr = {
  1. cl_desc : class_expr_desc;
  2. cl_loc : Location.t;
  3. cl_type : Types.class_type;
  4. cl_env : unit;
  5. cl_attributes : string;
}
Sourceand class_expr_desc =
  1. | Tcl_constraint of class_expr * Types.class_type option * string list * string list * unit list
  2. | Tcl_structure of class_structure
  3. | Tcl_fun of string * pattern * class_expr * unit
  4. | Tcl_apply of class_expr * (string * expression option) list
  5. | Tcl_let of Types.rec_flag * value_binding list * class_expr
  6. | Tcl_ident of Path.t * unit * core_type list
Sourceand module_type_constraint =
  1. | Tmodtype_implicit
  2. | Tmodtype_explicit of module_type
Sourceand row_field =
  1. | Ttag of string Asttypes.loc * string * bool * core_type list
  2. | Tinherit of core_type
Sourceand package_type = {
  1. pack_path : Path.t;
  2. pack_fields : (string * core_type) list;
  3. pack_type : Types.module_type;
  4. pack_txt : Longident.t Asttypes.loc;
}
Sourceand constant =
  1. | Const_int of int
  2. | Const_char of char
  3. | Const_string of string * string option
  4. | Const_float of string
  5. | Const_int32 of int32
  6. | Const_int64 of int64
  7. | Const_nativeint of nativeint
Sourceand constructor_description = {
  1. cstr_name : string;
  2. cstr_res : Types.type_expr;
  3. cstr_existentials : Types.type_expr list;
  4. cstr_args : Types.type_expr list;
  5. cstr_arity : int;
  6. cstr_tag : constructor_tag;
  7. cstr_consts : int;
  8. cstr_nonconsts : int;
  9. cstr_normal : int;
  10. cstr_private : private_flag;
  11. cstr_generalized : bool;
  12. cstr_loc : Location.t;
  13. cstr_attributes : string;
  14. cstr_inlined : type_declaration option;
}
Sourceand constructor_tag =
  1. | Cstr_constant of int
  2. | Cstr_block of int
  3. | Cstr_unboxed
  4. | Cstr_extension of Path.t * bool
Sourceand label_description = {
  1. lbl_name : string;
  2. lbl_res : Types.type_expr;
  3. lbl_arg : Types.type_expr;
  4. lbl_mut : Types.mutable_flag;
  5. lbl_pos : int;
  6. lbl_all : label_description array;
  7. lbl_repres : Types.record_representation;
  8. lbl_private : private_flag;
  9. lbl_loc : Location.t;
  10. lbl_attributes : string;
}
Sourceand closed_flag =
  1. | Closed
  2. | Open
Sourceand override_flag =
  1. | Override
  2. | Fresh
Sourceand direction_flag =
  1. | Upto
  2. | Downto
Sourceand private_flag =
  1. | Private
  2. | Public
Sourceand partial =
  1. | Partial
  2. | Total