swc_css_codegen/
macros.rs

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
macro_rules! emit {
    ($g:expr,$n:expr) => {{
        use crate::Emit;

        $g.emit(&$n)?;
    }};
}

macro_rules! write_raw {
    ($g:expr,$span:expr,$n:expr) => {{
        $g.wr.write_raw(Some($span), $n)?;
    }};

    ($g:expr,$n:expr) => {{
        $g.wr.write_raw(None, $n)?;
    }};
}

macro_rules! write_str {
    ($g:expr,$span:expr,$n:expr) => {{
        $g.wr.write_str($span, $n)?;
    }};
}

macro_rules! formatting_newline {
    ($g:expr) => {{
        if !$g.config.minify {
            $g.wr.write_newline()?;
        }
    }};
}

macro_rules! space {
    ($g:expr) => {{
        $g.wr.write_space()?;
    }};
}

macro_rules! formatting_space {
    ($g:expr) => {{
        if !$g.config.minify {
            $g.wr.write_space()?;
        }
    }};
}

macro_rules! semi {
    ($g:expr) => {{
        write_raw!($g, ";");
    }};
}

macro_rules! formatting_semi {
    ($g:expr) => {{
        if !$g.config.minify {
            write_raw!($g, ";");
        }
    }};
}

macro_rules! increase_indent {
    ($g:expr) => {{
        if !$g.config.minify {
            $g.wr.increase_indent();
        }
    }};
}

macro_rules! decrease_indent {
    ($g:expr) => {{
        if !$g.config.minify {
            $g.wr.decrease_indent();
        }
    }};
}
macro_rules! lo_span_offset {
    ($s:expr,$o:expr) => {{
        if $s.is_dummy() {
            DUMMY_SP
        } else {
            Span::new($s.lo, $s.lo + BytePos($o))
        }
    }};
}

macro_rules! hi_span_offset {
    ($s:expr,$o:expr) => {{
        if $s.is_dummy() {
            DUMMY_SP
        } else {
            Span::new($s.hi - BytePos($o), $s.hi)
        }
    }};
}