Skip to content

Commit

Permalink
fix is_method_call even with parentheses and chain
Browse files Browse the repository at this point in the history
  • Loading branch information
tbashiyy committed Nov 4, 2024
1 parent 25d7554 commit 310dc5c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/oxc_linter/src/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,14 @@ pub fn is_method_call<'a>(
}
}

let Some(member_expr) = call_expr.callee.without_parentheses().as_member_expression() else {
return false;
let callee_without_parentheses = call_expr.callee.without_parentheses();
let member_expr = match callee_without_parentheses {
match_member_expression!(Expression) => callee_without_parentheses.to_member_expression(),
Expression::ChainExpression(chain) => match chain.expression {
match_member_expression!(ChainElement) => chain.expression.to_member_expression(),
ChainElement::CallExpression(_) => return false,
},
_ => return false,
};

if let Some(objects) = objects {
Expand Down

0 comments on commit 310dc5c

Please sign in to comment.