swc_ecma_lexer/common/
context.rs

1bitflags::bitflags! {
2  #[derive(Debug, Clone, Copy, Default)]
3  pub struct Context: u32 {
4
5      /// `true` while backtracking
6      const IgnoreError = 1 << 0;
7
8      /// Is in module code?
9      const Module = 1 << 1;
10      const CanBeModule = 1 << 2;
11      const Strict = 1 << 3;
12
13      const ForLoopInit = 1 << 4;
14      const ForAwaitLoopInit = 1 << 5;
15
16      const IncludeInExpr = 1 << 6;
17      /// If true, await expression is parsed, and "await" is treated as a
18      /// keyword.
19      const InAsync = 1 << 7;
20      /// If true, yield expression is parsed, and "yield" is treated as a
21      /// keyword.
22      const InGenerator = 1 << 8;
23
24      /// If true, await is treated as a keyword.
25      const InStaticBlock = 1 << 9;
26
27      const IsContinueAllowed = 1 << 10;
28      const IsBreakAllowed = 1 << 11;
29
30      const InType = 1 << 12;
31      /// Typescript extension.
32      const ShouldNotLexLtOrGtAsType = 1 << 13;
33      /// Typescript extension.
34      const InDeclare = 1 << 14;
35
36      /// If true, `:` should not be treated as a type annotation.
37      const InCondExpr = 1 << 15;
38      const WillExpectColonForCond = 1 << 16;
39
40      const InClass = 1 << 17;
41
42      const InClassField = 1 << 18;
43
44      const InFunction = 1 << 19;
45
46      /// This indicates current scope or the scope out of arrow function is
47      /// function declaration or function expression or not.
48      const InsideNonArrowFunctionScope = 1 << 20;
49
50      const InParameters = 1 << 21;
51
52      const HasSuperClass = 1 << 22;
53
54      const InPropertyName = 1 << 23;
55
56      const InForcedJsxContext = 1 << 24;
57
58      // If true, allow super.x and super[x]
59      const AllowDirectSuper = 1 << 25;
60
61      const IgnoreElseClause = 1 << 26;
62
63      const DisallowConditionalTypes = 1 << 27;
64
65      const AllowUsingDecl = 1 << 28;
66
67      const TopLevel = 1 << 29;
68
69      const TsModuleBlock = 1 << 30;
70  }
71}