Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed method call not considering callee optional #2985

Merged
merged 10 commits into from
Dec 18, 2023
Prev Previous commit
Next Next commit
refactor: code refactored
  • Loading branch information
Bayheck committed Dec 14, 2023
commit 305d573edfb9e06ca540b2e5e4bea44abcb02bce
6 changes: 3 additions & 3 deletions src/processing/script/transformers/method-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const transformer: Transformer<CallExpression> = {
},

run: node => {
const callee = node.callee as MemberExpression;
const method = callee.computed
const callee = node.callee as MemberExpression;
const method = callee.computed
? callee.property as Literal
: createSimpleLiteral((callee.property as Identifier).name); // eslint-disable-line no-extra-parens
const optional = (node as SimpleCallExpression).optional;
const optional = (node as SimpleCallExpression).optional;
const ownerOptional = callee.optional;

return createMethodCallWrapper(callee.object as Expression, method, node.arguments, optional, ownerOptional);
Expand Down