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 Nov 15, 2020
@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Nov 15, 2020

The CI failure is a bug in a dependency.

@snitin315
Copy link
Contributor Author

snitin315 commented Nov 16, 2020

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

@existentialism
Copy link
Member

existentialism commented Nov 16, 2020

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

Not to land this PR, no.

@snitin315 snitin315 force-pushed the fix/arrow-fn-transformation branch from 5330ae1 to 6e456db Compare Nov 18, 2020
@snitin315
Copy link
Contributor Author

snitin315 commented Nov 18, 2020

The tests are passing locally 😕

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Nov 18, 2020

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

@snitin315 snitin315 force-pushed the fix/arrow-fn-transformation branch from 6e456db to 98e7154 Compare Nov 19, 2020
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

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

snitin315 commented Mar 28, 2021

I will update the PR 👍

@snitin315 snitin315 force-pushed the fix/arrow-fn-transformation branch from 98e7154 to c4b1d30 Compare Apr 18, 2021
@snitin315
Copy link
Contributor Author

snitin315 commented Apr 18, 2021

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

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

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

@nicolo-ribaudo nicolo-ribaudo force-pushed the fix/arrow-fn-transformation branch from 16e82c2 to 2cbb3ec Compare May 9, 2021
if (thisEnvFn.scope.path.isProgram()) {
return t.conditionalExpression(
t.binaryExpression(
"===",
t.unaryExpression("typeof", args()),
t.stringLiteral("undefined"),
),
thisEnvFn.scope.buildUndefinedNode(),
args(),
);
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo May 9, 2021

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

snitin315 commented May 10, 2021

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 approved these changes Jul 6, 2021
@JLHwung JLHwung merged commit bc1b953 into babel:main Jul 6, 2021
24 of 26 checks passed
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 Jul 6, 2021
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