1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use bitflags::bitflags;
use oxc_index::define_index_type;

define_index_type! {
    pub struct ClassId = u32;
}
define_index_type! {
    pub struct ElementId = u32;
}

bitflags! {
    #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
    pub struct ElementKind: u8 {
        const Accessor = 1 << 0;
        const Method = 1 << 1;
        const Property = 1 << 2;
        const Setter = 1 << 3;
        const Getter = 1 << 4;
    }
}

impl ElementKind {
    pub fn is_property(self) -> bool {
        self.contains(Self::Property)
    }

    pub fn is_method(self) -> bool {
        self.contains(Self::Method)
    }

    pub fn is_accessor(self) -> bool {
        self.contains(Self::Accessor)
    }

    pub fn is_setter_or_getter(self) -> bool {
        self.intersects(Self::Setter | Self::Getter)
    }
}