package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

dune-project
 Dependency

Authors

Maintainers

Sources

merlin-5.6-503.tbz
sha256=b0dcad092aaaf7a23f65ab9a089e8761bd665cc72357909e0ac6c2182f4fc2d4
sha512=9987baf2b2e82bab4c90a328bfcba9945e797e0f3d947156f04435ee84b49542844b379e35a79027c3ffe81f4b7a8f1c60803233999b4c039d4598033371880d

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