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: Id);
    fn report_assign(&mut self, ctx: Ctx, i: Id, is_op: bool, ty: Value<Type>);
    fn declare_decl(
        &mut self,
        ctx: Ctx,
        i: &Ident,
        init_type: Option<Value<Type>>,
        kind: Option<VarDeclKind>,
    ) -> &mut Self::VarData;
    fn get_initialized_cnt(&self) -> usize;
    fn truncate_initialized_cnt(&mut self, len: usize);
    fn mark_property_mutation(&mut self, id: Id);
}

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: Id)

source

fn report_assign(&mut self, ctx: Ctx, i: Id, is_op: bool, ty: Value<Type>)

source

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

source

fn get_initialized_cnt(&self) -> usize

source

fn truncate_initialized_cnt(&mut self, len: usize)

source

fn mark_property_mutation(&mut self, id: Id)

Object Safety§

This trait is not object safe.

Implementors§