diff options
Diffstat (limited to 'third_party/rust/jsparagus-generated-parser/src/declaration_kind.rs')
-rw-r--r-- | third_party/rust/jsparagus-generated-parser/src/declaration_kind.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/third_party/rust/jsparagus-generated-parser/src/declaration_kind.rs b/third_party/rust/jsparagus-generated-parser/src/declaration_kind.rs new file mode 100644 index 0000000000..7771d7f5f3 --- /dev/null +++ b/third_party/rust/jsparagus-generated-parser/src/declaration_kind.rs @@ -0,0 +1,43 @@ +// The kind of declaration. +// +// This is used for error reporting and also for handling early error check. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum DeclarationKind { + FormalParameter, + + Var, + Let, + Const, + + Class, + + Import, + + BodyLevelFunction, + + LexicalFunction, + LexicalAsyncOrGenerator, + + // This is used after parsing the entire function/script body. + VarForAnnexBLexicalFunction, + + CatchParameter, +} + +impl DeclarationKind { + pub fn to_str(&self) -> &'static str { + match self { + Self::FormalParameter => "formal parameter", + Self::Var => "var", + Self::Let => "let", + Self::Const => "const", + Self::Class => "class", + Self::Import => "import", + Self::BodyLevelFunction => "function", + Self::LexicalFunction => "function", + Self::LexicalAsyncOrGenerator => "function", + Self::VarForAnnexBLexicalFunction => "function", + Self::CatchParameter => "catch parameter", + } + } +} |