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

Fix arrow transformation when arguments is defined as variable #12344

Merged
merged 4 commits into from Jul 6, 2021

Conversation

snitin315
Copy link
Contributor

@snitin315 snitin315 commented Nov 11, 2020

Q                       A
Fixed Issues? Fixes #11385, fixes #7673
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Fixes #11385

@babel-bot
Copy link
Collaborator

babel-bot commented Nov 11, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45949/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 11, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2cbb3ec:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@snitin315 snitin315 changed the title fix: arrow-fn transformation when is defined as var fix: arrow-fn transformation when arguments is defined as var Nov 11, 2020
@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Nov 11, 2020
@snitin315 snitin315 force-pushed the fix/arrow-fn-transformation branch 2 times, most recently from f38831d to c353aa4 Compare November 15, 2020 03:51
@nicolo-ribaudo
Copy link
Member

The CI failure is a bug in a dependency.

@snitin315
Copy link
Contributor Author

So do we have to wait for the patch release of the dep?

@existentialism
Copy link
Member

So do we have to wait for the patch release of the dep?

Not to land this PR, no.

@snitin315
Copy link
Contributor Author

The tests are passing locally 😕

@nicolo-ribaudo
Copy link
Member

Since the failures seems realted to this PR, try rebasing on main, running make bootstrap and then OVERWRITE=true yarn jest.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Hey I'm sorry that we forgot about this PR for four months 😅

I left some comments, but if you aren't interested anymore since it's been so long I can make the necessary changes.

@snitin315
Copy link
Contributor Author

I will update the PR 👍

@snitin315
Copy link
Contributor Author

@nicolo-ribaudo I have updated the PR, please take a look.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I realized I had this pending comment since your last commit, and I forgot to send the review 😅

Comment on lines +236 to +245
if (thisEnvFn.scope.path.isProgram()) {
return t.conditionalExpression(
t.binaryExpression(
"===",
t.unaryExpression("typeof", args()),
t.stringLiteral("undefined"),
),
thisEnvFn.scope.buildUndefinedNode(),
args(),
);
Copy link
Member

Choose a reason for hiding this comment

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

I added this code to avoid the error described in #7673. It still isn't 100% correct since sometimes it doesn't throw the error if arguments is undeclared, but at least it doesn't throw for valid code.

@nicolo-ribaudo nicolo-ribaudo changed the title fix: arrow-fn transformation when arguments is defined as var Fix arrow transformation when arguments is defined as variable May 9, 2021
@snitin315
Copy link
Contributor Author

Thanks for the update 👍

@nicolo-ribaudo nicolo-ribaudo added this to To review in Nicolò's ideal PR review order list via automation May 31, 2021
@JLHwung JLHwung merged commit bc1b953 into babel:main Jul 6, 2021
Nicolò's ideal PR review order list automation moved this from To review to Done Jul 6, 2021
@snitin315 snitin315 deleted the fix/arrow-fn-transformation branch July 6, 2021 22:30
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Jul 30, 2021
…el#12344)

* fix: arrow-fn transformation when 'arguments' is defined as var

* fix: tests

* refactor: code

* Review by @nicolo-ribaudo

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
6 participants