Skip to content

Commit 256ff21

Browse files
SamChou19815facebook-github-bot
authored andcommitted
[flow][refactor][EZ] Files.init ~> Files.ordered_and_unordered_lib_paths
Summary: Unlike what the name currently suggests, it doesn't init anything. This diff renames it to something much more precise. Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D69872227 fbshipit-source-id: ca7527ecfda2e7ac80a2f0e7978cd10104845815
1 parent 7b624f5 commit 256ff21

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

src/codemods/utils/codemod_runner.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ module UntypedRunner (C : UNTYPED_RUNNER_CONFIG) : STEP_RUNNER = struct
687687
Profiling_js.with_profiling_lwt ~label:"Codemod" ~should_print_summary (fun _profiling ->
688688
let file_options = Options.file_options options in
689689
let all = Options.all options in
690-
let (_ordered_libs, libs) = Files.init file_options in
690+
let (_ordered_libs, libs) = Files.ordered_and_unordered_lib_paths file_options in
691691

692692
(* creates a closure that lists all files in the given root, returned in chunks *)
693693
let filename_set = get_target_filename_set ~options:file_options ~libs ~all roots in

src/commands/lsCommand.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ let main
248248
let options =
249249
make_options ~flowconfig ~root ~ignore_flag ~include_flag ~untyped_flag ~declaration_flag
250250
in
251-
let (_, libs) = Files.init options in
251+
let (_, libs) = Files.ordered_and_unordered_lib_paths options in
252252
(* `flow ls` and `flow ls dir` will list out all the flow files. We want to include lib files, so
253253
* we pass in ~libs:SSet.empty, which means we won't filter out any lib files *)
254254
let next_files =

src/common/files.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ let implicitly_include_root options = options.implicitly_include_root
9292

9393
let includes options = options.includes
9494

95-
let lib_paths options = options.lib_paths
96-
9795
let module_declaration_dirnames options = options.module_declaration_dirnames
9896

9997
let module_file_exts options = options.module_file_exts
@@ -546,7 +544,7 @@ let is_in_flowlib (options : options) : string -> bool =
546544
let root = File_path.make root_str in
547545
is_prefix (File_path.to_string root)
548546

549-
let init (options : options) =
547+
let ordered_and_unordered_lib_paths (options : options) =
550548
let node_module_filter = is_node_module options in
551549
let libs = options.lib_paths in
552550
let (libs, filter) =

src/common/files.mli

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ val implicitly_include_root : options -> bool
4343

4444
val includes : options -> Path_matcher.t
4545

46-
val lib_paths : options -> File_path.t list
47-
4846
val module_declaration_dirnames : options -> string list
4947

5048
val module_file_exts : options -> string list
@@ -108,7 +106,7 @@ val is_in_flowlib : options -> string -> bool
108106

109107
val get_all_watched_extensions : options -> SSet.t
110108

111-
val init : options -> string list * SSet.t
109+
val ordered_and_unordered_lib_paths : options -> string list * SSet.t
112110

113111
(* regexp for Filename constants *)
114112
val dir_sep : Str.regexp

src/server/rechecker/recheck_updates.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ let process_updates ?(skip_incompatible = false) ~options ~libs updates =
202202
let file_options = Options.file_options options in
203203
let all_libs =
204204
let known_libs = libs in
205-
let (_, maybe_new_libs) = Files.init file_options in
205+
let (_, maybe_new_libs) = Files.ordered_and_unordered_lib_paths file_options in
206206
SSet.union known_libs maybe_new_libs
207207
in
208208
let root = Options.root options in

src/services/inference/types_js.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ let init_from_scratch ~profiling ~workers options =
21642164
* However making this change is likely going to be a breaking change for people with conflicting
21652165
* libraries
21662166
*)
2167-
let (ordered_libs, libs) = Files.init file_options in
2167+
let (ordered_libs, libs) = Files.ordered_and_unordered_lib_paths file_options in
21682168
let next_files_for_parse =
21692169
make_next_files ~libs ~file_options ~include_libdef:true (Options.root options)
21702170
in
@@ -2413,7 +2413,7 @@ let reinit_full_check
24132413
let%lwt env =
24142414
with_transaction "partial-reinit" @@ fun transaction reader ->
24152415
let file_options = Options.file_options options in
2416-
let (ordered_libs, _) = Files.init file_options in
2416+
let (ordered_libs, _) = Files.ordered_and_unordered_lib_paths file_options in
24172417

24182418
let%lwt (env, libs_ok) =
24192419
init_with_initial_state

0 commit comments

Comments
 (0)