mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fundamentally this PR is about lowering identifiers during construction of HIR. For now i'm punting on context variables and assuming all variables are either global, module-scoped, or locals. The implementation involves a few pieces: * `estree::Identifer` gets extended with optional binding information. The idea is that _some_ name resolution mechanism will populate this. Eventually our own, but we can also borrow data from another source... * `estree-swc` now configures SWC's (possibly broken?) name resolution mechanism and sets the above binding data when translating identifiers from swc into our estree format. * hir `Builder` tracks identifiers based on `(name, BindingId)` pairs, and assigns a unique `hir::Identifier` instance for each pair. `Identifiers` are clone-able (shared). * Tangential: i updated the printer to handle more instruction variants, including the now-ported LoadGlobal instr. I don't love this but it's a start. Long-term we definitely should have our own name resolution mechanism which we run on the estree prior to lowering to HIR.