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

Skip unnecessary temp vars in path.insertAfter #14268

Merged
merged 7 commits into from Feb 14, 2022

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Feb 13, 2022

Q                       A
Tests Added + Pass? Yes
License MIT

@nicolo-ribaudo nicolo-ribaudo added the PR: Output optimization 🔬 A type of pull request used for our changelog categories label Feb 13, 2022
@babel-bot
Copy link
Collaborator

babel-bot commented Feb 13, 2022

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

@nicolo-ribaudo nicolo-ribaudo changed the title Avoid storing value of expressions hidden in sequences Skip some unnecessary temp vars in path.insertAfter Feb 13, 2022
@nicolo-ribaudo
Copy link
Member Author

Searching for _temp = in our fixtures doesn't show other unnecessary variables 🥳

@nicolo-ribaudo nicolo-ribaudo changed the title Skip some unnecessary temp vars in path.insertAfter Skip unnecessary temp vars in path.insertAfter Feb 13, 2022
} else {
// Inserting after the computed key of a method should insert the
// temporary binding in the method's parent's scope.
if (parentPath.isMethod({ computed: true, key: node })) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR: also need handling property and decorator expression.

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

💯

@nicolo-ribaudo nicolo-ribaudo merged commit 020a7b0 into babel:main Feb 14, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the traverse-no-temp-var-in-seq branch February 14, 2022 19:55
@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 May 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2022
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: Output optimization 🔬 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants