mirror of
https://github.com/facebook/react.git
synced 2026-02-27 03:07:57 +00:00
Our logic to detect hoisting relies on Babel's `isReferencedIdentifier()` to determine whether a reference to an identifier is a reference or a declaration. The idea is that we want to find references to variables that may be hoistable, before the declaration — the definition of hoisting. But due to the bug in isReferencedIdentifier, we skipped over reassignments of hoisted variables. The hack here checks if an identifier is a direct child of an AssignmentExpression, ensuring we visit reassignments.