package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

dune-project
 Dependency

Authors

Maintainers

Sources

merlin-5.8.1-505.tbz
sha256=b8fb32bc0fc092af2fd6bdc831cb966057f2e3fd7b99a172b705e96ba8082583
sha512=01ca96f8167d062ba24036e43f650ff958fb157d44867bd52eb7999b7d19bf9fc97cdcd46c04b6979f0e1149d5041047723eed5913b03c4404d7acb116183bee

doc/src/merlin-lib.ocaml_typing/saved_parts.ml.html

Source file saved_parts.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let attribute = Location.mknoloc "merlin.saved-parts"

module H = Ephemeron.K1.Make(struct
    type t = string
    let hash = Hashtbl.hash
    let equal (a : t) (b : t) =  a = b
  end)

let table = H.create 7

let gensym =
  let counter = ref 0 in
  fun () -> incr counter; !counter

let store parts =
  let id = string_of_int (gensym ()) in
  let key = Parsetree.Pconst_integer (id, None) in
  H.add table id parts;
  key

let find = function
  | Parsetree.Pconst_integer (id, None) ->
    begin
      try H.find table id
      with Not_found -> []
    end
  | _ -> assert false