swc_ecma_usage_analyzer/
marks.rs

1#![allow(dead_code)]
2
3use swc_common::{Mark, SyntaxContext};
4
5#[derive(Debug, Clone, Copy)]
6pub struct Marks {
7    ///  `/** @const */`.
8    pub const_ann: Mark,
9
10    /// Check for `/*#__NOINLINE__*/`
11    pub noinline: Mark,
12
13    /// Check for `/*#__PURE__*/`
14    pub pure: Mark,
15
16    /// This is applied to [swc_ecma_ast::BlockStmt] which is injected to
17    /// preserve the side effects.
18    pub fake_block: Mark,
19
20    pub top_level_ctxt: SyntaxContext,
21
22    pub unresolved_mark: Mark,
23}
24
25impl Marks {
26    #[allow(clippy::new_without_default)]
27    pub fn new() -> Self {
28        fn m() -> Mark {
29            Mark::new()
30        }
31
32        Marks {
33            const_ann: m(),
34            noinline: m(),
35            pure: m(),
36            fake_block: m(),
37            top_level_ctxt: SyntaxContext::empty().apply_mark(m()),
38            unresolved_mark: m(),
39        }
40    }
41}