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

feat(es/minifier): Mark more expressions as pure #6204

Merged
merged 16 commits into from Oct 20, 2022
Merged

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Oct 19, 2022

Description:

Related issue:

This reverts commit 0096b40ba775c2a85a059242dc32c7c6ad07c1ac.
@kdy1 kdy1 added this to the Planned milestone Oct 19, 2022
@kdy1 kdy1 self-assigned this Oct 19, 2022
@kdy1 kdy1 changed the title feat(es/minifier): Resolve trivial TODOs chore(es/minifier): Resolve trivial TODOs Oct 19, 2022
@kdy1 kdy1 changed the title chore(es/minifier): Resolve trivial TODOs feat(es/minifier): Mark more expressions as pure Oct 19, 2022
@@ -301,7 +301,7 @@ where
/// If a parameter is not used, we can ignore return value of the
/// corresponding argument.
pub(super) fn ignore_unused_args_of_iife(&mut self, e: &mut CallExpr) {
if !self.options.unused {
if !self.options.unused && !self.options.reduce_vars {
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this because of

console.log(
(function (a, b) {
var c = a,
c = b;
b++;
return c;
})(1, 2)
);

Copy link
Member Author

@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_minifier

@kdy1 kdy1 marked this pull request as ready for review October 20, 2022 03:49
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 20, 2022
@kdy1 kdy1 requested a review from jridgewell October 20, 2022 03:49
jridgewell
jridgewell previously approved these changes Oct 20, 2022
@@ -1,2 +1,2 @@
//// [templateStringWithEmbeddedNewOperator.ts]
"abc".concat(new String("Hi"), "def");
new String("Hi");
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably isn't important with String, but it's common for Map/WeakMap to be used. Are we eliminating built in constructors?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but we are not dropping String. I think we should, though.

Expr::New(NewExpr { callee, args, .. })
if callee.is_one_of_global_ref_to(
&self.expr_ctx,
&["Map", "Set", "Array", "Object", "Boolean", "Number"],
) =>

crates/swc_ecma_utils/src/lib.rs Show resolved Hide resolved
@kdy1 kdy1 dismissed stale reviews from jridgewell and kodiakhq via bcc7e00 October 20, 2022 04:20
@kdy1 kdy1 enabled auto-merge (squash) October 20, 2022 04:27
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

@kdy1 kdy1 merged commit cc848db into swc-project:main Oct 20, 2022
@kdy1 kdy1 deleted the terser branch October 20, 2022 05:06
@kdy1 kdy1 modified the milestones: Planned, v1.3.10 Oct 21, 2022
@swc-project swc-project locked as resolved and limited conversation to collaborators Nov 20, 2022
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.

None yet

3 participants