Skip to content

Commit

Permalink
[flow] Make lib files always have empty file sig
Browse files Browse the repository at this point in the history
Summary:
Since we banned imports in libdef files, we should always generate an empty File_sig (which only contains import info) for them.

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D67991579

fbshipit-source-id: 3e5febf5e5019a966979b6c1c2e1af82335d1904
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Jan 15, 2025
1 parent 7695ba3 commit ff29c7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/parsing/parsing_service_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ let do_parse ~options ~docblock ?(locs_to_dirtify = []) content file =
Parse_skip Skip_non_flow_file
else
let (ast, parse_errors) = parse_source_file ~options content file in
let file_sig = parse_file_sig options file docblock ast in
let file_sig =
if File_key.is_lib_file file then
File_sig.empty
else
parse_file_sig options file docblock ast
in
let requires = File_sig.require_set file_sig |> SSet.elements |> Array.of_list in
(*If you want efficiency, can compute globals along with file_sig in the above function since scope is computed when computing file_sig*)
let (_, (_, _, globals)) =
Expand Down

0 comments on commit ff29c7d

Please sign in to comment.