Skip to content

Commit 549e38d

Browse files
authored
doc(es): Improve documentation (#10247)
**Description:** Add some documentations to some methods. **Related issue:** - Closes #10244
1 parent 69788d7 commit 549e38d

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
swc_common: patch
3+
swc_ecma_ast: patch
4+
swc_core: patch
5+
---
6+
7+
doc(es): Improve documentation

crates/swc_common/src/syntax_pos.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

crates/swc_ecma_ast/src/ident.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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()))

0 commit comments

Comments
 (0)