swc_ecma_transforms_base/
scope.rs

1use swc_ecma_ast::VarDeclKind;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
4pub enum ScopeKind {
5    Block,
6    #[default]
7    Fn,
8}
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum IdentType {
12    Binding,
13    Ref,
14    Label,
15}
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub enum DeclKind {
19    Lexical,
20    Param,
21    Var,
22    Function,
23    /// don't actually get stored
24    Type,
25}
26
27impl From<VarDeclKind> for DeclKind {
28    fn from(kind: VarDeclKind) -> Self {
29        match kind {
30            VarDeclKind::Const | VarDeclKind::Let => Self::Lexical,
31            VarDeclKind::Var => Self::Var,
32        }
33    }
34}