Debian Codegraph @

vernac/comExtraDeps.ml

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Names
12 open CErrors
13
14 let extra_deps = Summary.ref ~name:"extra_deps" ~stage:Summary.Stage.Synterp Id.Map.empty
15
16 let bind_extra_dep ?loc path id =
17 match Id.Map.find_opt id !extra_deps with
18 | Some (other,loc) ->
19 user_err Pp.(str "Extra dependency " ++ Id.print id ++
20 str " already bound to " ++ str other ++
21 pr_opt (fun x -> str " at " ++ Loc.pr x) loc ++ str ".")
22 | None -> extra_deps := Id.Map.add id (path,loc) !extra_deps
23
24 let declare_extra_dep ?loc ~from ~file id =
25 let file_path = Loadpath.find_extra_dep_with_logical_path ?loc ~from ~file () in
26 Option.iter (bind_extra_dep ?loc file_path) id
27
28 let query_extra_dep id = fst @@ Id.Map.find id !extra_deps