-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow][get-def] Better heuristics for def_loc of module ref of requir…
…ed ESM module Summary: As discussed in D67869373, the current reason-based heuristic for module-ref logic is quite broken. This diff starts to use a new heuristic. For ESM modules with default exports, we will use the default export as the def_loc of the require. Otherwise, we will pick the first export location instead. This is the same heuristic we use for the error location of common interface files: https://github.com/facebook/flow/blob/70811720be890cd85eb5dbf95fca2dbf960973bd/src/typing/module_info_analyzer.ml#L357-L389 Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D67875259 ------------------------------------------------------------------------ (from 18d2b3f9e08ff3d4182c0e9ec04754a62157ac93) fbshipit-source-id: c07d84a494db0cd5514416c35d6de422658af57b
- Loading branch information
1 parent
18717c9
commit 6443137
Showing
4 changed files
with
56 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @flow | ||
|
||
export const foo = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
// ^ | ||
'm#./ParentESM'; | ||
// ^ | ||
'm#./ParentESM2'; | ||
// ^ |