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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::{Property, Rule};
use swc_common::{ast_node, Span};

#[ast_node("SupportsRule")]
pub struct SupportsRule {
    pub span: Span,

    pub query: SupportQuery,

    pub rules: Vec<Rule>,
}

#[ast_node]
pub enum SupportQuery {
    #[tag("NotSupportQuery")]
    Not(NotSupportQuery),

    #[tag("AndSupportQuery")]
    And(AndSupportQuery),

    #[tag("OrSupportQuery")]
    Or(OrSupportQuery),

    #[tag("Property")]
    Property(Property),

    #[tag("ParenSupportQuery")]
    Paren(ParenSupportQuery),
}

#[ast_node("NotSupportQuery")]
pub struct NotSupportQuery {
    pub span: Span,
    pub query: Box<SupportQuery>,
}

#[ast_node("AndSupportQuery")]
pub struct AndSupportQuery {
    pub span: Span,
    pub left: Box<SupportQuery>,
    pub right: Box<SupportQuery>,
}

#[ast_node("OrSupportQuery")]
pub struct OrSupportQuery {
    pub span: Span,
    pub left: Box<SupportQuery>,
    pub right: Box<SupportQuery>,
}

#[ast_node("ParenSupportQuery")]
pub struct ParenSupportQuery {
    pub span: Span,
    pub query: Box<SupportQuery>,
}