Skip to content

capture thisArg of optionalChaining in parens #35494

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

Merged
merged 1 commit into from
Mar 4, 2021

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Dec 4, 2019

Fixes: #35476

@rbuckton for review

//// [parentheses.js]
var _a;
(o1)(o1 !== null && o1 !== void 0 ? o1 : 1);
(o2 === null || o2 === void 0 ? void 0 : o2.b).call(o2, o1 !== null && o1 !== void 0 ? o1 : 1);
Copy link

@jridgewell jridgewell Dec 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this doesn’t need a .call:

o2 === null || o2 === void 0 ? void 0 : o2.b(o1 ?? 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that wouldn't throw an error if o2 is nullish.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, it's wrapped in parens. Never mind, forgot that made the call non-optional.

@sandersn sandersn added the For Milestone Bug PRs that fix a bug with a specific milestone label Feb 1, 2020
@rbuckton
Copy link
Contributor

@ajafff can you update this PR? Optional chaining has moved from esnext.ts to es2020.ts and the factory function calls need to be updated to use factory. to use the new NodeFactory API.

@rbuckton rbuckton force-pushed the call-paren-optionalchain branch from e12664a to 82f0538 Compare March 4, 2021 02:41
@rbuckton
Copy link
Contributor

rbuckton commented Mar 4, 2021

I've gone ahead and made the necessary updates. Once CI passes I will merge.

@rbuckton rbuckton merged commit 15e69ac into microsoft:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Optional Chaining does not propagate receiver when parenthesized
4 participants