Merlin_specific.Browse_rawBrowse_node offers a uniform interface to traverse constructions from * TypedTree. * * Mutually recursive types from TypedTree are wrapped into different * constructors of the type node. * Then the fold function traverses one-level of sub-nodes. * * In the meantime, the most specific environment and location are threaded * (FIXME: should these two be managed separately?). * * Finally BrowseT module a node into a tree which structure mimics * the recursive structure of the TypedTree node. *
type constructor_declaration = Ocaml_typing.Typedtree.constructor_declarationtype node = | Dummy| Pattern : _ Ocaml_typing.Typedtree.general_pattern -> node| Expression of Ocaml_typing.Typedtree.expression| Case : _ Ocaml_typing.Typedtree.case -> node| Class_expr of Ocaml_typing.Typedtree.class_expr| Class_structure of Ocaml_typing.Typedtree.class_structure| Class_field of Ocaml_typing.Typedtree.class_field| Class_field_kind of Ocaml_typing.Typedtree.class_field_kind| Module_expr of Ocaml_typing.Typedtree.module_expr| Module_type_constraint of Ocaml_typing.Typedtree.module_type_constraint| Structure of Ocaml_typing.Typedtree.structure| Signature of Ocaml_typing.Typedtree.signature| Structure_item of Ocaml_typing.Typedtree.structure_item * Ocaml_typing.Env.t| Signature_item of Ocaml_typing.Typedtree.signature_item * Ocaml_typing.Env.t| Module_binding of Ocaml_typing.Typedtree.module_binding| Value_binding of Ocaml_typing.Typedtree.value_binding| Module_type of Ocaml_typing.Typedtree.module_type| Module_declaration of Ocaml_typing.Typedtree.module_declaration| Module_type_declaration of Ocaml_typing.Typedtree.module_type_declaration| With_constraint of Ocaml_typing.Typedtree.with_constraint| Core_type of Ocaml_typing.Typedtree.core_type| Package_type of Ocaml_typing.Typedtree.package_type| Row_field of Ocaml_typing.Typedtree.row_field| Value_description of Ocaml_typing.Typedtree.value_description| Type_declaration of Ocaml_typing.Typedtree.type_declaration| Type_kind of Ocaml_typing.Typedtree.type_kind| Type_extension of Ocaml_typing.Typedtree.type_extension| Extension_constructor of Ocaml_typing.Typedtree.extension_constructor| Label_declaration of Ocaml_typing.Typedtree.label_declaration| Constructor_declaration of Ocaml_typing.Typedtree.constructor_declaration| Class_type of Ocaml_typing.Typedtree.class_type| Class_signature of Ocaml_typing.Typedtree.class_signature| Class_type_field of Ocaml_typing.Typedtree.class_type_field| Class_declaration of Ocaml_typing.Typedtree.class_declaration| Class_description of Ocaml_typing.Typedtree.class_description| Class_type_declaration of Ocaml_typing.Typedtree.class_type_declaration| Binding_op of Ocaml_typing.Typedtree.binding_op| Include_description of Ocaml_typing.Typedtree.include_description| Include_declaration of Ocaml_typing.Typedtree.include_declaration| Open_description of Ocaml_typing.Typedtree.open_description| Open_declaration of Ocaml_typing.Typedtree.open_declaration| Method_call of Ocaml_typing.Typedtree.expression
* Ocaml_typing.Typedtree.meth
* Ocaml_parsing.Location.t| Record_field : [ `Expression of Ocaml_typing.Typedtree.expression
| `Pattern of Ocaml_typing.Typedtree.pattern ]
* 'rep Ocaml_typing.Types.gen_label_description
* 'rep Ocaml_typing.Types.record_form
* Ocaml_parsing.Longident.t Ocaml_parsing.Location.loc -> node| Module_binding_name of Ocaml_typing.Typedtree.module_binding| Module_declaration_name of Ocaml_typing.Typedtree.module_declaration| Module_type_declaration_name of Ocaml_typing.Typedtree.module_type_declaration| Mode of Ocaml_parsing.Parsetree.mode Ocaml_parsing.Location.loc| Modality of Ocaml_parsing.Parsetree.modality Ocaml_parsing.Location.loc| Jkind_annotation of Ocaml_parsing.Parsetree.jkind_annotation| Attribute of Ocaml_typing.Typedtree.attributeThe location of an Attribute is considered to be the location of the attr_name, not the overall attribute. This is because in an Mbrowse.t, an Attribute is not the parent node of its payload. Thus, to ensure that sibling nodes do not have overlapping locations (otherwise Mtyper.node_at would break), we cannot use the location of the entire attribute.
val fold_node :
(Ocaml_typing.Env.t -> node -> 'a -> 'a) ->
Ocaml_typing.Env.t ->
node ->
'a ->
'aFold over the children of a node. Note that this is not deep.
Accessors for information specific to a node
val node_update_env : Ocaml_typing.Env.t -> node -> Ocaml_typing.Env.tval node_real_loc :
Ocaml_parsing.Location.t ->
node ->
Ocaml_parsing.Location.tval node_merlin_loc :
Ocaml_parsing.Location.t ->
node ->
Ocaml_parsing.Location.tval node_attributes : node -> Ocaml_typing.Typedtree.attribute listval has_attr : name:string -> node -> boolval string_of_node : node -> stringval node_paths : node -> Ocaml_typing.Path.t Ocaml_parsing.Location.loc listval node_paths_and_longident :
node ->
(Ocaml_typing.Path.t Ocaml_parsing.Location.loc * Ocaml_parsing.Longident.t)
listval node_is_constructor :
node ->
[ `Description of Ocaml_typing.Types.constructor_description
| `Declaration of Ocaml_typing.Typedtree.constructor_declaration
| `Extension_constructor of Ocaml_typing.Typedtree.extension_constructor ]
Ocaml_parsing.Location.loc
optionval node_of_binary_part :
Ocaml_typing.Env.t ->
Ocaml_typing.Cmt_format.binary_part ->
nodeval all_holes :
(Ocaml_typing.Env.t * node) ->
(Ocaml_parsing.Location.t
* Ocaml_typing.Env.t
* [ `Exp of Ocaml_typing.Types.type_expr
| `Mod of Ocaml_typing.Types.module_type ])
list