-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metro-transform-plugins: Avoid generating duplicate references to the…
… same node Summary: Babel does not deal well with multiple references to the same node in a single AST. Specifically it can lead to `NodePath`s not being unique and therefore to incorrect scope analyses - see babel/babel#6375 for pointers to manifestations of this in Babel. These days, Babel's test suite ensures that Babel's first-party plugins do not emit such duplicates (babel/babel#7149) but there is no such guarantee for third-party plugins. This diff: 1. fixes the logic in `import-export-plugin` to avoid emitting repeated nodes. 2. adds tests to *all* the Babel plugins in `metro-transform-plugins` asserting that there are no repeated nodes in the resulting ASTs. See also the similar facebook/fbjs#440 Reviewed By: GijsWeterings Differential Revision: D28646299 fbshipit-source-id: 9cceed06cad1d21214f47ecaaaab2d12e6ba031c
- Loading branch information
1 parent
c955c50
commit 4fea2bd
Showing
3 changed files
with
49 additions
and
20 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
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