Files
react/compiler/packages/babel-plugin-react-compiler/src/Inference
Joe Savona 5061f31f4b compiler: distinguish globals/imports/module-locals
We currently use `LoadGlobal` and `StoreGlobal` to represent any read (or write) of a variable defined outside the component or hook that is being compiled. This is mostly fine, but for a lot of things we want to do going forward (resolving types across modules, for example) it helps to understand the actual source of a variable.

This PR is an incremental step in that direction. We continue to use LoadGlobal/StoreGlobal, but LoadGlobal now has a `binding:NonLocalBinding` instead of just the name of the global. The NonLocalBinding type tells us whether it was an import (and which kind, the source module name etc), a module-local binding, or a true global. By keeping the LoadGlobal/StoreGlobal instructions, most code that deals with "anything not declared locally" doesn't have to care about the difference. However, code that _does_ want to know the source of the value can figure it out.

ghstack-source-id: e701d4ebc0
Pull Request resolved: https://github.com/facebook/react/pull/29188
2024-05-24 10:20:26 +01:00
..
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00