jon.recoil.org

Source file shape_reducer.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

# 3 "./shape_reducer.cppo.ml"
type t = Shape.t -> Shape.Uid.t option

# 6 "./shape_reducer.cppo.ml"
let rec traverse_aliases = function
  | Shape_reduce.Resolved uid -> Some uid
  | Approximated id -> id
  | Resolved_alias (_, x) -> traverse_aliases x
  | _ -> None

# 13 "./shape_reducer.cppo.ml"
let make ~lookup_impl =
  let read_unit_shape ~unit_name =
    match lookup_impl unit_name with
    | Some impl -> (
        match impl.Odoc_model.Lang.Implementation.shape_info with
        | Some (shape, _) -> Some shape
        | None -> None)
    | None -> None
  in
  
# 34 "./shape_reducer.cppo.ml"
  let module Reduce = Shape_reduce.Make (struct
    let fuel = 10
    let read_unit_shape ~unit_name = read_unit_shape ~unit_name
    
# 38 "./shape_reducer.cppo.ml"
    let fuel () = Misc.Maybe_bounded.of_int 10
    let fuel_for_compilation_units () = Misc.Maybe_bounded.Unbounded
    let max_shape_reduce_steps_per_variable () = Misc.Maybe_bounded.Unbounded
    let max_compilation_unit_depth () = Misc.Maybe_bounded.Unbounded
    let projection_rules_for_merlin_enabled = true
    let read_unit_shape ~diagnostics:_ ~unit_name = read_unit_shape ~unit_name
  
# 45 "./shape_reducer.cppo.ml"
  end) in
  fun query ->
    match
      (try Some (Reduce.reduce_for_uid Odoc_model.Paths.Ocaml_env.empty query)
       with Not_found -> None)
    with
    | Some r -> traverse_aliases r
    | None -> None

# 55 "./shape_reducer.cppo.ml"
let reduce_for_uid t shape = t shape