Static GLOBALS
pub static GLOBALS: ScopedKey<Globals>
Available on crate features
__ecma
and __utils
only.Expand description
Storage for span hygiene data.
This variable is used to manage identifiers or to identify nodes. Note that it’s stored as a thread-local storage, but actually it’s shared between threads.
§Usages
§Configuring
use swc_common::GLOBALS;
GLOBALS.set(&Default::default(), || {
// Do operations that require span hygiene
});
§Span hygiene
Marks are stored in this variable.
You can see the document how swc uses the span hygiene info at https://rustdoc.swc.rs/swc_ecma_transforms_base/resolver/fn.resolver_with_mark.html