fix(parser): parse DecoratorCallExpression when Arguments contains MemberExpression (#3265)

closes #3261
closes #3262

```
DecoratorCallExpression[Yield, Await] :
  DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
```
This commit is contained in:
Boshen 2024-05-14 03:18:41 +00:00
parent 3644400aed
commit c4ccf9f4d8
6 changed files with 16 additions and 9 deletions

View file

@ -750,7 +750,10 @@ impl<'a> ParserImpl<'a> {
) -> Result<Expression<'a>> { ) -> Result<Expression<'a>> {
// ArgumentList[Yield, Await] : // ArgumentList[Yield, Await] :
// AssignmentExpression[+In, ?Yield, ?Await] // AssignmentExpression[+In, ?Yield, ?Await]
let call_arguments = self.with_context(Context::In, CallArguments::parse)?; let ctx = self.ctx;
self.ctx = ctx.and_in(true).and_decorator(false);
let call_arguments = CallArguments::parse(self)?;
self.ctx = ctx;
Ok(self.ast.call_expression( Ok(self.ast.call_expression(
self.end_span(lhs_span), self.end_span(lhs_span),
lhs, lhs,

View file

@ -1,3 +1,3 @@
codegen_misc Summary: codegen_misc Summary:
AST Parsed : 15/15 (100.00%) AST Parsed : 16/16 (100.00%)
Positive Passed: 15/15 (100.00%) Positive Passed: 16/16 (100.00%)

View file

@ -0,0 +1,4 @@
class Foo {
@Bar({ x: Map['String'] })
quaz() {}
}

View file

@ -1,6 +1,6 @@
parser_misc Summary: parser_misc Summary:
AST Parsed : 15/15 (100.00%) AST Parsed : 16/16 (100.00%)
Positive Passed: 15/15 (100.00%) Positive Passed: 16/16 (100.00%)
Negative Passed: 8/8 (100.00%) Negative Passed: 8/8 (100.00%)
× Unexpected token × Unexpected token

View file

@ -1,6 +1,6 @@
prettier_misc Summary: prettier_misc Summary:
AST Parsed : 15/15 (100.00%) AST Parsed : 16/16 (100.00%)
Positive Passed: 8/15 (53.33%) Positive Passed: 9/16 (56.25%)
Expect to Parse: "pass/oxc-1740.tsx" Expect to Parse: "pass/oxc-1740.tsx"
Expect to Parse: "pass/oxc-2087.ts" Expect to Parse: "pass/oxc-2087.ts"
Expect to Parse: "pass/oxc-2394.ts" Expect to Parse: "pass/oxc-2394.ts"

View file

@ -1,3 +1,3 @@
transformer_misc Summary: transformer_misc Summary:
AST Parsed : 15/15 (100.00%) AST Parsed : 16/16 (100.00%)
Positive Passed: 15/15 (100.00%) Positive Passed: 16/16 (100.00%)