Skip to content

Commit

Permalink
[flow][refactor][EZ] Files.init ~> `Files.ordered_and_unordered_lib…
Browse files Browse the repository at this point in the history
…_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
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Feb 21, 2025
1 parent 7b624f5 commit 256ff21
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/codemods/utils/codemod_runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ module UntypedRunner (C : UNTYPED_RUNNER_CONFIG) : STEP_RUNNER = struct
Profiling_js.with_profiling_lwt ~label:"Codemod" ~should_print_summary (fun _profiling ->
let file_options = Options.file_options options in
let all = Options.all options in
let (_ordered_libs, libs) = Files.init file_options in
let (_ordered_libs, libs) = Files.ordered_and_unordered_lib_paths file_options in

(* creates a closure that lists all files in the given root, returned in chunks *)
let filename_set = get_target_filename_set ~options:file_options ~libs ~all roots in
Expand Down
2 changes: 1 addition & 1 deletion src/commands/lsCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ let main
let options =
make_options ~flowconfig ~root ~ignore_flag ~include_flag ~untyped_flag ~declaration_flag
in
let (_, libs) = Files.init options in
let (_, libs) = Files.ordered_and_unordered_lib_paths options in
(* `flow ls` and `flow ls dir` will list out all the flow files. We want to include lib files, so
* we pass in ~libs:SSet.empty, which means we won't filter out any lib files *)
let next_files =
Expand Down
4 changes: 1 addition & 3 deletions src/common/files.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ let implicitly_include_root options = options.implicitly_include_root

let includes options = options.includes

let lib_paths options = options.lib_paths

let module_declaration_dirnames options = options.module_declaration_dirnames

let module_file_exts options = options.module_file_exts
Expand Down Expand Up @@ -546,7 +544,7 @@ let is_in_flowlib (options : options) : string -> bool =
let root = File_path.make root_str in
is_prefix (File_path.to_string root)

let init (options : options) =
let ordered_and_unordered_lib_paths (options : options) =
let node_module_filter = is_node_module options in
let libs = options.lib_paths in
let (libs, filter) =
Expand Down
4 changes: 1 addition & 3 deletions src/common/files.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ val implicitly_include_root : options -> bool

val includes : options -> Path_matcher.t

val lib_paths : options -> File_path.t list

val module_declaration_dirnames : options -> string list

val module_file_exts : options -> string list
Expand Down Expand Up @@ -108,7 +106,7 @@ val is_in_flowlib : options -> string -> bool

val get_all_watched_extensions : options -> SSet.t

val init : options -> string list * SSet.t
val ordered_and_unordered_lib_paths : options -> string list * SSet.t

(* regexp for Filename constants *)
val dir_sep : Str.regexp
Expand Down
2 changes: 1 addition & 1 deletion src/server/rechecker/recheck_updates.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ let process_updates ?(skip_incompatible = false) ~options ~libs updates =
let file_options = Options.file_options options in
let all_libs =
let known_libs = libs in
let (_, maybe_new_libs) = Files.init file_options in
let (_, maybe_new_libs) = Files.ordered_and_unordered_lib_paths file_options in
SSet.union known_libs maybe_new_libs
in
let root = Options.root options in
Expand Down
4 changes: 2 additions & 2 deletions src/services/inference/types_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,7 @@ let init_from_scratch ~profiling ~workers options =
* However making this change is likely going to be a breaking change for people with conflicting
* libraries
*)
let (ordered_libs, libs) = Files.init file_options in
let (ordered_libs, libs) = Files.ordered_and_unordered_lib_paths file_options in
let next_files_for_parse =
make_next_files ~libs ~file_options ~include_libdef:true (Options.root options)
in
Expand Down Expand Up @@ -2413,7 +2413,7 @@ let reinit_full_check
let%lwt env =
with_transaction "partial-reinit" @@ fun transaction reader ->
let file_options = Options.file_options options in
let (ordered_libs, _) = Files.init file_options in
let (ordered_libs, _) = Files.ordered_and_unordered_lib_paths file_options in

let%lwt (env, libs_ok) =
init_with_initial_state
Expand Down

0 comments on commit 256ff21

Please sign in to comment.