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): Abort seq inliner if a same var is defined in outer scope #7772

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

Austaras
Copy link
Member

@Austaras Austaras commented Aug 7, 2023

Description:

The algorithm here is directly copied from terser, I don't if it's correct or can be improved, but it does fixes the issue.

Related issue:

usage.ref_count += 1;
}
self.data.vars.insert((id.0, *ctx), usage);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The improvement of output come from here.

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.

swc-bump:

  • swc_ecma_utils

@kdy1 kdy1 changed the title fix(es/minifier): Abort seq inliner if encountered var defined in out… fix(es/minifier): Abort seq inliner if encountered var defined in outer scope Aug 9, 2023
@kdy1 kdy1 changed the title fix(es/minifier): Abort seq inliner if encountered var defined in outer scope fix(es/minifier): Abort seq inliner if a same var is defined in outer scope Aug 9, 2023
@kdy1 kdy1 added this to the Planned milestone Aug 9, 2023
@kdy1 kdy1 enabled auto-merge (squash) August 9, 2023 19:11
Copy link
Collaborator

@swc-bot swc-bot left a comment

Choose a reason for hiding this comment

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

Automated review comment generated by auto-rebase script

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.

reset ci

@kdy1 kdy1 merged commit ef8d121 into swc-project:main Aug 9, 2023
250 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.3.76 Aug 10, 2023
kdy1 pushed a commit to kdy1/swc that referenced this pull request Aug 15, 2023
… scope (swc-project#7772)

**Description:**

The algorithm here is directly copied from terser, I don't if it's correct or can be improved, but it does fix the issue.


**Related issue:**

 - Closes swc-project#7749
kdy1 pushed a commit that referenced this pull request Aug 17, 2023
…ned (#7804)

**Description:**

It turns out that the original implementation of `infect`is incomplete
because it cannot cover function param, and the new implementation
introduced in #7772 is redundant because what
[terser](https://github.com/terser/terser/blob/master/lib/compress/tighten-body.js#L909C18-L909C28)
do is basically checking `fn_local`


**Related issue:**

 - Closes #7784
@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Minify changes the order of statements
4 participants