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
16 changes: 9 additions & 7 deletions crates/oxc_parser/src/js/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,10 @@ impl<'a> ParserImpl<'a> {
let mut optional = false;
let mut callee = self.parse_member_expression_or_higher(&mut optional)?;

let mut type_parameter = None;
let mut type_arguments = None;
if let Expression::TSInstantiationExpression(instantiation_expr) = callee {
let instantiation_expr = instantiation_expr.unbox();
type_parameter.replace(instantiation_expr.type_arguments);
type_arguments.replace(instantiation_expr.type_arguments);
callee = instantiation_expr.expression;
}

Expand Down Expand Up @@ -876,7 +876,7 @@ impl<'a> ParserImpl<'a> {
self.error(diagnostics::new_optional_chain(span));
}

Ok(self.ast.expression_new(span, callee, arguments, type_parameter))
Ok(self.ast.expression_new(span, callee, arguments, type_arguments))
}

/// Section 13.3 Call Expression
Expand Down Expand Up @@ -905,10 +905,12 @@ impl<'a> ParserImpl<'a> {
}

if type_arguments.is_some() || self.at(Kind::LParen) {
if let Expression::TSInstantiationExpression(expr) = lhs {
let expr = expr.unbox();
type_arguments.replace(expr.type_arguments);
lhs = expr.expression;
if !optional_call {
if let Expression::TSInstantiationExpression(expr) = lhs {
let expr = expr.unbox();
type_arguments.replace(expr.type_arguments);
lhs = expr.expression;
}
}

lhs =
Expand Down
3 changes: 1 addition & 2 deletions tasks/coverage/snapshots/estree_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: 15392346

estree_typescript Summary:
AST Parsed : 10619/10725 (99.01%)
Positive Passed: 9036/10725 (84.25%)
Positive Passed: 9037/10725 (84.26%)
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts
A class member cannot have the 'const' keyword.
Mismatch: tasks/coverage/typescript/tests/cases/compiler/accessOverriddenBaseClassMember1.ts
Expand Down Expand Up @@ -780,7 +780,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/objectLiteralMem
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/objectLiteralMemberWithQuestionMark1.ts
Expected `,` but found `?`
Mismatch: tasks/coverage/typescript/tests/cases/compiler/objectRestSpread.ts
Mismatch: tasks/coverage/typescript/tests/cases/compiler/optionalChainWithInstantiationExpression2.ts
Mismatch: tasks/coverage/typescript/tests/cases/compiler/optionalParameterProperty.ts
Mismatch: tasks/coverage/typescript/tests/cases/compiler/overloadsWithConstraints.ts
Mismatch: tasks/coverage/typescript/tests/cases/compiler/overrideBaseIntersectionMethod.ts
Expand Down
Loading