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(es/minifier): don't reserve identifiers in expressions or patterns #8883

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Auspicus
Copy link
Contributor

@Auspicus Auspicus commented Apr 22, 2024

Description:

#3424 added support for the reserved mangle option which prevents identifiers from being mangled when listed in the array. This is fine in most cases but can cause issues when the compressor brings two reserved variables into the same scope. When this occurs the generated code results in a parsing error due to the duplicate identifier.

This PR adds a test to cover this case and a proposed fix by ignoring reserved identifiers for patterns and expressions.

BREAKING CHANGE:

Related issue (if exists):
fixes #8622

Copy link

changeset-bot bot commented Apr 22, 2024

⚠️ No Changeset found

Latest commit: 3345890

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Auspicus Auspicus changed the title fix(es/minifier): prevent a private variable name being reused when it is specified as a reserved identifier fix(es/minifier): don't reserve identifiers in expressions or patterns Apr 22, 2024
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

I think this change is good. Can you undraft it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

variable is declared multiple times when variable is reserved and there are 2 passes and target is >=es2015
2 participants