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 babel-bot commented Nov 11, 2020

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

@codesandbox
Copy link

@codesandbox codesandbox 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
@snitin315 snitin315 force-pushed the snitin315:fix/arrow-fn-transformation branch 2 times, most recently from f38831d to c353aa4 Nov 15, 2020
@nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Nov 15, 2020

The CI failure is a bug in a dependency.

@snitin315
Copy link
Contributor Author

@snitin315 snitin315 commented Nov 16, 2020

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

@existentialism
Copy link
Member

@existentialism 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 snitin315:fix/arrow-fn-transformation branch from 5330ae1 to 6e456db Nov 18, 2020
@snitin315
Copy link
Contributor Author

@snitin315 snitin315 commented Nov 18, 2020

The tests are passing locally 😕

@nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo 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 snitin315:fix/arrow-fn-transformation branch from 6e456db to 98e7154 Nov 19, 2020
@snitin315 snitin315 requested review from JLHwung and nicolo-ribaudo 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 snitin315 commented Mar 28, 2021

I will update the PR 👍

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

@snitin315 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 snitin315:fix/arrow-fn-transformation branch from 16e82c2 to 2cbb3ec May 9, 2021
if (thisEnvFn.scope.path.isProgram()) {
return t.conditionalExpression(
t.binaryExpression(
"===",
t.unaryExpression("typeof", args()),
t.stringLiteral("undefined"),
),
thisEnvFn.scope.buildUndefinedNode(),
args(),
);
Comment on lines +236 to +245

This comment has been minimized.

@nicolo-ribaudo

nicolo-ribaudo May 9, 2021
Member

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 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
24 of 26 checks passed
@github-actions
Prepare Cache
Details
@github-actions
Test on Node.js Latest
Details
@github-actions
Build Babel Artifacts
Details
@github-actions
Test Babel 8 breaking changes
Details
@github-actions
Publish to local Verdaccio registry
Details
@github-actions
Lint
Details
@github-actions
Test on Node.js (14)
Details
@github-actions
Test on Node.js (12)
Details
@github-actions
Test on Node.js (10)
Details
@github-actions
Test on Node.js (8)
Details
@github-actions
Test on Node.js (6)
Details
@github-actions
Test on Windows
Details
@github-actions
Third-party Parser Tests
Details
@github-actions
Test @babel/runtime integrations
Details
@github-actions
E2E (babel)
Details
@github-actions
E2E (babel-old-version)
Details
@github-actions
E2E (create-react-app)
Details
@github-actions
E2E (vue-cli)
Details
@github-actions
E2E (jest)
Details
@circleci-checks
e2e-breaking-pr Workflow: e2e-breaking-pr
Details
@circleci-checks
test262-pr Workflow: test262-pr
Details
@gitpod-io
Gitpod Open an online workspace in Gitpod
Details
@babel-bot
babel/repl REPL preview is available
Details
@circleci-checks
build-standalone Workflow: build-standalone
Details
@codesandbox
ci/codesandbox Building packages succeeded.
Details
@codecov
codecov/project 91.68% (target 90.00%)
Details
Nicolò's ideal PR review order list automation moved this from To review to Done Jul 6, 2021
@snitin315 snitin315 deleted the snitin315: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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment