diff --git a/crates/oxc_parser/src/js/object.rs b/crates/oxc_parser/src/js/object.rs index 21a54953aba38e..a53b2ff491c93e 100644 --- a/crates/oxc_parser/src/js/object.rs +++ b/crates/oxc_parser/src/js/object.rs @@ -50,7 +50,7 @@ impl<'a> ParserImpl<'a> { modifier_kind if self.ts_enabled() && modifier_kind.is_modifier_kind() - && !matches!(peek_kind, Kind::Colon) => + && peek_kind.is_identifier_or_keyword() => { if let Ok(modifier) = Modifier::try_from(self.cur_token()) { self.error(diagnostics::modifier_cannot_be_used_here(&modifier)); diff --git a/tasks/coverage/parser_misc.snap b/tasks/coverage/parser_misc.snap index c4b1c12158f450..74cac2fca50a63 100644 --- a/tasks/coverage/parser_misc.snap +++ b/tasks/coverage/parser_misc.snap @@ -1,41 +1,7 @@ parser_misc Summary: -AST Parsed : 19/21 (90.48%) -Positive Passed: 19/21 (90.48%) +AST Parsed : 21/21 (100.00%) +Positive Passed: 21/21 (100.00%) Negative Passed: 11/11 (100.00%) -Expect to Parse: "pass/oxc-2948-2.ts" - - × 'readonly' modifier cannot be used here. - ╭─[pass/oxc-2948-2.ts:18:13] - 17 │ - 18 │ const x = { readonly, override }; - · ──────── - 19 │ const y = { readonly: readonly, override: override }; - ╰──── - - × Unexpected token - ╭─[pass/oxc-2948-2.ts:18:21] - 17 │ - 18 │ const x = { readonly, override }; - · ─ - 19 │ const y = { readonly: readonly, override: override }; - ╰──── -Expect to Parse: "pass/oxc-3948-1.ts" - - × 'accessor' modifier cannot be used here. - ╭─[pass/oxc-3948-1.ts:107:12] - 106 │ - 107 │ return { accessor, part, tracker, workingCopyBackupService: workingCopyBackupService, instantiationService }; - · ──────── - 108 │ } - ╰──── - - × Unexpected token - ╭─[pass/oxc-3948-1.ts:107:20] - 106 │ - 107 │ return { accessor, part, tracker, workingCopyBackupService: workingCopyBackupService, instantiationService }; - · ─ - 108 │ } - ╰──── × Unexpected token ╭─[fail/oxc-169.js:2:1] diff --git a/tasks/coverage/parser_typescript.snap b/tasks/coverage/parser_typescript.snap index cb1c27a9fccbec..f60c6e031067a8 100644 --- a/tasks/coverage/parser_typescript.snap +++ b/tasks/coverage/parser_typescript.snap @@ -11382,20 +11382,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╰──── help: either remove this super, or extend the class - × 'private' modifier cannot be used here. - ╭─[conformance/classes/indexMemberDeclarations/privateIndexer2.ts:4:5] - 3 │ var x = { - 4 │ private [x: string]: string; - · ─────── - 5 │ } - ╰──── - - × Expected `]` but found `:` - ╭─[conformance/classes/indexMemberDeclarations/privateIndexer2.ts:4:15] + × Expected `,` but found `[` + ╭─[conformance/classes/indexMemberDeclarations/privateIndexer2.ts:4:13] 3 │ var x = { 4 │ private [x: string]: string; - · ┬ - · ╰── `]` expected + · ┬ + · ╰── `,` expected 5 │ } ╰──── diff --git a/tasks/coverage/prettier_misc.snap b/tasks/coverage/prettier_misc.snap index 921a872712d439..e6048bc3aa7bfc 100644 --- a/tasks/coverage/prettier_misc.snap +++ b/tasks/coverage/prettier_misc.snap @@ -1,11 +1,13 @@ prettier_misc Summary: AST Parsed : 21/21 (100.00%) -Positive Passed: 13/21 (61.90%) +Positive Passed: 11/21 (52.38%) Expect to Parse: "pass/oxc-1740.tsx" Expect to Parse: "pass/oxc-2087.ts" Expect to Parse: "pass/oxc-2394.ts" Expect to Parse: "pass/oxc-2674.tsx" Expect to Parse: "pass/oxc-2723.jsx" +Expect to Parse: "pass/oxc-2948-2.ts" Expect to Parse: "pass/oxc-3910.ts" +Expect to Parse: "pass/oxc-3948-1.ts" Expect to Parse: "pass/swc-1627.js" Expect to Parse: "pass/swc-8243.tsx"