Skip to content

Simplify helper-function-name logic#16652

Merged
nicolo-ribaudo merged 3 commits intobabel:mainfrom
nicolo-ribaudo:simplify-helper-function-name
Jul 16, 2024
Merged

Simplify helper-function-name logic#16652
nicolo-ribaudo merged 3 commits intobabel:mainfrom
nicolo-ribaudo:simplify-helper-function-name

Conversation

@nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
  • We had some logic to avoid variable renames when injecting a new ID with the same name that in practice refers to the same variable. Remove that logic, as
    1. it's not actually necessary
    2. it's based on specific knowledge of our arrow functions transform, and might not apply to other callers of the helper
  • We were assigning a newId[NOT_LOCAL_BINDING] = true, but that's not needed anymore

@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jul 16, 2024
@babel-bot
Copy link
Collaborator

babel-bot commented Jul 16, 2024

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

@nicolo-ribaudo
Copy link
Member Author

@JLHwung I pushed a new commit, since I noticed that we have a custom wrapper for generators that we don't actually need (we can just return the generator object without yield*ing it, similarly to how we don't await promises).

@nicolo-ribaudo nicolo-ribaudo force-pushed the simplify-helper-function-name branch from 7441178 to 343a024 Compare July 16, 2024 16:23
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.

Nice catch.

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

We were assigning a newId[NOT_LOCAL_BINDING] = true, but that's not needed anymore

This is awesome, and this is the only plugin that sets it.

I pushed a new commit, since I noticed that we have a custom wrapper for generators that we don't actually need (we can just return the generator object without yield*ing it, similarly to how we don't await promises).

I suspect this is to keep FUNCTION_ID.prototype unchanged, but I think the new behavior is fine.

@nicolo-ribaudo
Copy link
Member Author

This is awesome, and this is the only plugin that sets it.

We can then remove from wherever it's used, I'm not sure whether it should be considered a breaking change (for old versions of this plugin) or not.

I suspect this is to keep FUNCTION_ID.prototype unchanged, but I think the new behavior is fine.

Yeah we already loose the prototype in many other wrapping cases

@nicolo-ribaudo nicolo-ribaudo merged commit 482008c into babel:main Jul 16, 2024
@nicolo-ribaudo nicolo-ribaudo deleted the simplify-helper-function-name branch July 16, 2024 23:48
@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 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2024
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: Internal 🏠 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

Comments