File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ swc_common : patch
3+ swc_ecma_ast : patch
4+ swc_core : patch
5+ ---
6+
7+ doc(es): Improve documentation
Original file line number Diff line number Diff line change @@ -136,6 +136,16 @@ better_scoped_tls::scoped_tls!(
136136 ///
137137 /// # Usages
138138 ///
139+ /// ## Configuring
140+ ///
141+ /// ```rust
142+ /// use swc_common::GLOBALS;
143+ ///
144+ /// GLOBALS.set(&Default::default(), || {
145+ /// // Do operations that require span hygiene
146+ /// });
147+ /// ```
148+ ///
139149 /// ## Span hygiene
140150 ///
141151 /// [Mark]s are stored in this variable.
Original file line number Diff line number Diff line change @@ -572,6 +572,14 @@ impl Ident {
572572 }
573573 }
574574
575+ /// Creates a new private identifier. A private identifier is an identifier
576+ /// that is guaranteed to be unique.
577+ ///
578+ /// See https://swc.rs/docs/contributing/es-commons/variable-management for more details.
579+ ///
580+ /// Note: This method requires configuring
581+ /// [GLOBALS](`swc_common::GLOBALS`) because this method use [`Mark::new`]
582+ /// internally.
575583 #[ inline( never) ]
576584 pub fn new_private ( sym : Atom , span : Span ) -> Self {
577585 Self :: new ( sym, span, SyntaxContext :: empty ( ) . apply_mark ( Mark :: new ( ) ) )
You can’t perform that action at this time.
0 commit comments