swc_ecma_usage_analyzer::analyzer::storage

Trait Storage

Source
pub trait Storage: Sized + Default {
    type ScopeData: ScopeDataLike;
    type VarData: VarDataLike;

    // Required methods
    fn scope(&mut self, ctxt: SyntaxContext) -> &mut Self::ScopeData;
    fn top_scope(&mut self) -> &mut Self::ScopeData;
    fn var_or_default(&mut self, id: Id) -> &mut Self::VarData;
    fn merge(&mut self, kind: ScopeKind, child: Self);
    fn report_usage(&mut self, ctx: Ctx, i: &Ident, is_assign: bool);
    fn declare_decl(
        &mut self,
        ctx: Ctx,
        i: &Ident,
        has_init: bool,
        kind: Option<VarDeclKind>,
    ) -> &mut Self::VarData;
    fn get_initialized_cnt(&self) -> usize;
    fn truncate_initialized_cnt(&mut self, len: usize);
}

Required Associated Types§

Required Methods§

Source

fn scope(&mut self, ctxt: SyntaxContext) -> &mut Self::ScopeData

Source

fn top_scope(&mut self) -> &mut Self::ScopeData

Source

fn var_or_default(&mut self, id: Id) -> &mut Self::VarData

Source

fn merge(&mut self, kind: ScopeKind, child: Self)

Source

fn report_usage(&mut self, ctx: Ctx, i: &Ident, is_assign: bool)

Source

fn declare_decl( &mut self, ctx: Ctx, i: &Ident, has_init: bool, kind: Option<VarDeclKind>, ) -> &mut Self::VarData

Source

fn get_initialized_cnt(&self) -> usize

Source

fn truncate_initialized_cnt(&mut self, len: usize)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§