swc_ecma_transforms_base::rename

Trait Renamer

source
pub trait Renamer: Send + Sync {
    const RESET_N: bool;
    const MANGLE: bool;

    // Required method
    fn new_name_for(&self, orig: &Id, n: &mut usize) -> Atom;

    // Provided methods
    fn preserved_ids_for_module(&mut self, _: &Module) -> FxHashSet<Id> { ... }
    fn preserved_ids_for_script(&mut self, _: &Script) -> FxHashSet<Id> { ... }
    fn get_cached(&self) -> Option<Cow<'_, RenameMap>> { ... }
    fn store_cache(&mut self, _update: &RenameMap) { ... }
}

Required Associated Constants§

source

const RESET_N: bool

Should reset n to 0 for each identifier?

source

const MANGLE: bool

It should be true if you expect lots of collisions

Required Methods§

source

fn new_name_for(&self, orig: &Id, n: &mut usize) -> Atom

Should increment n.

Provided Methods§

source

fn preserved_ids_for_module(&mut self, _: &Module) -> FxHashSet<Id>

source

fn preserved_ids_for_script(&mut self, _: &Script) -> FxHashSet<Id>

source

fn get_cached(&self) -> Option<Cow<'_, RenameMap>>

source

fn store_cache(&mut self, _update: &RenameMap)

Object Safety§

This trait is not object safe.

Implementors§