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(minifier): remove unnecessary "use strict" #8173

Closed

Conversation

sapphi-red
Copy link
Contributor

No description provided.

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Dec 29, 2024
Copy link
Contributor Author

sapphi-red commented Dec 29, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

codspeed-hq bot commented Dec 29, 2024

CodSpeed Performance Report

Merging #8173 will not alter performance

Comparing 12-29-feat_minifier_remove_unnecessary_use_strict_ (ff48152) with main (fc43ec5)

Summary

✅ 29 untouched benchmarks

@sapphi-red sapphi-red force-pushed the 12-29-feat_minifier_remove_unnecessary_use_strict_ branch from 39eeb7b to fd9ef8b Compare December 29, 2024 05:06
@sapphi-red sapphi-red marked this pull request as ready for review December 29, 2024 05:07
Comment on lines +131 to +139
/// Drop `"use strict";` directives if the function is empty.
fn drop_use_strict_directives_if_function_is_empty(
body: &mut FunctionBody<'a>,
_ctx: &mut TraverseCtx<'a>,
) {
if body.statements.is_empty() {
body.directives.retain(|directive| !directive.is_use_strict());
}
}
Copy link
Contributor Author

@sapphi-red sapphi-red Dec 29, 2024

Choose a reason for hiding this comment

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

I'm not sure if it makes sense to exist in PeepholeRemoveDeadCode. This has to run after everything that might remove statements.

@Boshen Boshen changed the base branch from 12-29-feat_minifier_fold_string.length___array.length_ to graphite-base/8173 December 29, 2024 07:14
@Boshen Boshen force-pushed the graphite-base/8173 branch from f5a4570 to fc43ec5 Compare December 29, 2024 07:18
@Boshen Boshen force-pushed the 12-29-feat_minifier_remove_unnecessary_use_strict_ branch from fd9ef8b to 81378e3 Compare December 29, 2024 07:18
@Boshen Boshen changed the base branch from graphite-base/8173 to main December 29, 2024 07:19
@Boshen Boshen force-pushed the 12-29-feat_minifier_remove_unnecessary_use_strict_ branch from 81378e3 to ff48152 Compare December 29, 2024 07:19
@Boshen
Copy link
Member

Boshen commented Dec 31, 2024

This is not ideal, I'll try something else later.

@Boshen Boshen closed this Dec 31, 2024
@Boshen Boshen deleted the 12-29-feat_minifier_remove_unnecessary_use_strict_ branch December 31, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-minifier Area - Minifier C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants