Skip to content

Skip unnecessary temp vars in path.insertAfter#14268

Merged
nicolo-ribaudo merged 7 commits intobabel:mainfrom
nicolo-ribaudo:traverse-no-temp-var-in-seq
Feb 14, 2022
Merged

Skip unnecessary temp vars in path.insertAfter#14268
nicolo-ribaudo merged 7 commits intobabel:mainfrom
nicolo-ribaudo:traverse-no-temp-var-in-seq

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

4 participants