| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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 |