mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Multiple Place instances can share a reference to a given Identifier in our JS implementation. For simplicity of the initial port I’m using Rc (for sharing) and RefCell (for runtime-checked mutability). This is the standard pattern for shared mutable references in Rust when you don’t need multi-threaded support. We don’t need HIR to be accessible by multiple threads so this is fine, if we do multiple threads it will be to parallelize compilation of separate functions. There are other idioms w less runtime overhead, such as Place holding an index into a separate vec of identifiers, but that would make the port much less straightforward.