Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/oxc_parser/src/ts/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ impl<'a> ParserImpl<'a> {
kind: TSModuleDeclarationKind,
modifiers: &Modifiers<'a>,
) -> Result<Box<'a, TSModuleDeclaration<'a>>> {
self.verify_modifiers(
modifiers,
ModifierFlags::DECLARE | ModifierFlags::EXPORT,
diagnostics::modifier_cannot_be_used_here,
);
let id = match self.cur_kind() {
Kind::Str => self.parse_literal_string().map(TSModuleDeclarationName::StringLiteral),
_ => self.parse_identifier_name().map(TSModuleDeclarationName::Identifier),
Expand Down
45 changes: 45 additions & 0 deletions tasks/coverage/parser_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10826,6 +10826,13 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
2 │ }
╰────

× 'async' modifier cannot be used here.
╭─[conformance/async/es5/asyncModule_es5.ts:1:1]
1 │ async module M {
· ─────
2 │ }
╰────

× Expected `(` but found `Identifier`
╭─[conformance/async/es5/asyncSetter_es5.ts:2:13]
1 │ class C {
Expand Down Expand Up @@ -10961,6 +10968,13 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
2 │ }
╰────

× 'async' modifier cannot be used here.
╭─[conformance/async/es6/asyncModule_es6.ts:1:1]
1 │ async module M {
· ─────
2 │ }
╰────

× Expected `(` but found `Identifier`
╭─[conformance/async/es6/asyncSetter_es6.ts:2:13]
1 │ class C {
Expand Down Expand Up @@ -16569,6 +16583,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
× 'public' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:19:5]
18 │ module Y3 {
19 │ public module Module {
· ──────
20 │ class A { s: string }
╰────

× 'public' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:19:5]
18 │ module Y3 {
19 │ public module Module {
· ──────
20 │ class A { s: string }
Expand Down Expand Up @@ -16625,6 +16647,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
× 'private' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:44:5]
43 │ module YY3 {
44 │ private module Module {
· ───────
45 │ class A { s: string }
╰────

× 'private' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:44:5]
43 │ module YY3 {
44 │ private module Module {
· ───────
45 │ class A { s: string }
Expand Down Expand Up @@ -16681,6 +16711,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
× 'static' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:70:5]
69 │ module YYY3 {
70 │ static module Module {
· ──────
71 │ class A { s: string }
╰────

× 'static' modifier cannot be used here.
╭─[conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts:70:5]
69 │ module YYY3 {
70 │ static module Module {
· ──────
71 │ class A { s: string }
Expand Down Expand Up @@ -18128,6 +18166,13 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
2 │ }
╰────

× 'protected' modifier cannot be used here.
╭─[conformance/parser/ecmascript5/Protected/Protected2.ts:1:1]
1 │ protected module M {
· ─────────
2 │ }
╰────

× Expected a semicolon or an implicit semicolon after a statement, but found none
╭─[conformance/parser/ecmascript5/RealWorld/parserharness.ts:1430:16]
1429 │ // Regex for parsing options in the format "@Alpha: Value of any sort"
Expand Down