Remove push/pop_local_changes from FileProvider trait
[hiphop-php.git] / hphp / hack / src / providers / rust_provider_backend.ml
blobb3fbef8fa585204cca2122e7a1293892ce4a7ea2
1 (*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the "hack" directory of this source tree.
7 *)
9 open Hh_prelude
11 type t
13 external make_ffi :
14 root:string -> hhi_root:string -> tmp:string -> ParserOptions.t -> t
15 = "hh_rust_provider_backend_make"
17 let make popt =
18 make_ffi
19 ~root:Relative_path.(path_of_prefix Root)
20 ~hhi_root:Relative_path.(path_of_prefix Hhi)
21 ~tmp:Relative_path.(path_of_prefix Tmp)
22 popt
24 external push_local_changes : t -> unit
25 = "hh_rust_provider_backend_push_local_changes"
27 external pop_local_changes : t -> unit
28 = "hh_rust_provider_backend_pop_local_changes"
30 module Decl = struct
31 external direct_decl_parse_and_cache :
32 t -> Relative_path.t -> Direct_decl_parser.parsed_file_with_hashes option
33 = "hh_rust_provider_backend_direct_decl_parse_and_cache"
35 external get_fun : t -> string -> Shallow_decl_defs.fun_decl option
36 = "hh_rust_provider_backend_get_fun"
38 external get_shallow_class :
39 t -> string -> Shallow_decl_defs.class_decl option
40 = "hh_rust_provider_backend_get_shallow_class"
42 external get_typedef : t -> string -> Shallow_decl_defs.typedef_decl option
43 = "hh_rust_provider_backend_get_typedef"
45 external get_gconst : t -> string -> Shallow_decl_defs.const_decl option
46 = "hh_rust_provider_backend_get_gconst"
48 external get_module : t -> string -> Shallow_decl_defs.module_decl option
49 = "hh_rust_provider_backend_get_module"
51 external get_folded_class : t -> string -> Decl_defs.decl_class_type option
52 = "hh_rust_provider_backend_get_folded_class"
53 end
55 module File = struct
56 type file_type =
57 | Disk of string
58 | Ide of string
60 external get : t -> Relative_path.t -> file_type option
61 = "hh_rust_provider_backend_file_provider_get"
63 external get_contents : t -> Relative_path.t -> string
64 = "hh_rust_provider_backend_file_provider_get_contents"
66 external provide_file_for_tests : t -> Relative_path.t -> string -> unit
67 = "hh_rust_provider_backend_file_provider_provide_file_for_tests"
69 external provide_file_for_ide : t -> Relative_path.t -> string -> unit
70 = "hh_rust_provider_backend_file_provider_provide_file_for_ide"
72 external provide_file_hint : t -> Relative_path.t -> file_type -> unit
73 = "hh_rust_provider_backend_file_provider_provide_file_hint"
75 external remove_batch : t -> Relative_path.Set.t -> unit
76 = "hh_rust_provider_backend_file_provider_remove_batch"
77 end
79 module Naming = struct
80 module type ReverseNamingTable = sig
81 type pos
83 val add : t -> string -> pos -> unit
85 val get_pos : t -> string -> pos option
87 val remove_batch : t -> string list -> unit
88 end
90 module Types = struct
91 type pos = FileInfo.pos * Naming_types.kind_of_type
93 external add : t -> string -> pos -> unit
94 = "hh_rust_provider_backend_naming_types_add"
96 external get_pos : t -> string -> pos option
97 = "hh_rust_provider_backend_naming_types_get_pos"
99 external remove_batch : t -> string list -> unit
100 = "hh_rust_provider_backend_naming_types_remove_batch"
102 external get_canon_name : t -> string -> string option
103 = "hh_rust_provider_backend_naming_types_get_canon_name"
106 module Funs = struct
107 type pos = FileInfo.pos
109 external add : t -> string -> pos -> unit
110 = "hh_rust_provider_backend_naming_funs_add"
112 external get_pos : t -> string -> pos option
113 = "hh_rust_provider_backend_naming_funs_get_pos"
115 external remove_batch : t -> string list -> unit
116 = "hh_rust_provider_backend_naming_funs_remove_batch"
118 external get_canon_name : t -> string -> string option
119 = "hh_rust_provider_backend_naming_funs_get_canon_name"
122 module Consts = struct
123 type pos = FileInfo.pos
125 external add : t -> string -> pos -> unit
126 = "hh_rust_provider_backend_naming_consts_add"
128 external get_pos : t -> string -> pos option
129 = "hh_rust_provider_backend_naming_consts_get_pos"
131 external remove_batch : t -> string list -> unit
132 = "hh_rust_provider_backend_naming_consts_remove_batch"
135 module Modules = struct
136 type pos = FileInfo.pos
138 external add : t -> string -> pos -> unit
139 = "hh_rust_provider_backend_naming_modules_add"
141 external get_pos : t -> string -> pos option
142 = "hh_rust_provider_backend_naming_modules_get_pos"
144 external remove_batch : t -> string list -> unit
145 = "hh_rust_provider_backend_naming_modules_remove_batch"
148 external get_db_path_ffi : t -> string option
149 = "hh_rust_provider_backend_naming_get_db_path"
151 let get_db_path t =
152 get_db_path_ffi t |> Option.map ~f:(fun path -> Naming_sqlite.Db_path path)
154 external set_db_path_ffi : t -> string -> unit
155 = "hh_rust_provider_backend_naming_set_db_path"
157 let set_db_path t (Naming_sqlite.Db_path path) = set_db_path_ffi t path
159 external get_filenames_by_hash :
160 t -> Typing_deps.DepSet.t -> Relative_path.Set.t
161 = "hh_rust_provider_backend_naming_get_filenames_by_hash"