mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
fe95b5df903903da6b372dcc2fd43f842ab3226d
--- In `lower`, we now ensure that all context variables are declared by a `DeclareContext` instruction. `DeclareContext` always produces a `let` declaration, and `StoreContext` is always a reassign. There are a few reasons we need `DeclareContext`: - DeclareLocal assumes it is storing to a SSA-fied identifier (which always stores an immutable primitive). This does not fit context variables. - Without DeclareContext, we need custom logic in some passes to initialize identifier / context state (e.g. `MutableRange`, ValueKind, etc) for the `StoreContext` that declares the context. This PR stack models context variables as concrete identifiers (with references to context variables modeled by `Place` referencing the context variable identifier). @josephsavona pointed out that this is abusing the notion of Identifier/Place, as context variables are essentially interior properties of a ContextEnvironment. Since we are not modeling `ContextEnvironment` implicitly or explicitly, all inference for context variables is essentially pointer analysis.
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%