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

Mark ThisExpression and Super as Purish #12251

Merged
merged 3 commits into from Oct 27, 2020

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Oct 25, 2020

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

I noticed that Pureish was used for literals and for functions, so it means "something that doesn't have side-effects when evaluated".
This has the effect of returning true from path.isPure() for this, potentially removing this when it's not used in some transforms.

Extracted from #12250.

The other purish types are functions and literals, so I
guess it means "it doesn't have side effects"
@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Oct 25, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Oct 25, 2020

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 25, 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 f962a32:

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

@@ -980,7 +980,7 @@ defineType("SwitchStatement", {
});

defineType("ThisExpression", {
aliases: ["Expression"],
aliases: ["Expression", "Pureish"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test in packages/babel-traverse/test/scope.js?

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Should we also mark Super as Pureish?

defineType("Super", {

@nicolo-ribaudo nicolo-ribaudo changed the title Mark ThisExpression as Purish Mark ThisExpression and Super as Purish Oct 26, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit df908fc into babel:main Oct 27, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the this-purish branch October 27, 2020 12:12
nicolo-ribaudo added a commit that referenced this pull request Nov 4, 2020
@babel babel deleted a comment from salvoravida Nov 4, 2020
@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 Feb 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 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 pkg: types PR: Internal 🏠 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