macro_rules! private_ident {
($name:expr) => { ... };
}Expand description
Creates a private (marked) SWC Ident.
Unlike ident!, this macro creates an identifier with a fresh hygiene mark,
making it unique and preventing name collisions with user code. Use this when
generating temporary variables or internal identifiers that shouldn’t conflict
with existing names in scope.
§Examples
Creating a unique temporary variable:
use macroforge_ts_syn::private_ident;
// Each call creates a unique identifier that won't clash
let temp1 = private_ident!("temp");
let temp2 = private_ident!("temp");
// temp1 and temp2 have different syntax contextsGenerating internal helper code:
use macroforge_ts_syn::{private_ident, quote};
let internal_var = private_ident!("__internal");
// This won't conflict with any user-defined __internal variable
let code = quote!("let $var = {};" as Stmt, var: Ident = internal_var);