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

minifier: block statements are not inlined in some cases #8708

Closed
sapphi-red opened this issue Jan 25, 2025 · 0 comments · Fixed by #8857
Closed

minifier: block statements are not inlined in some cases #8708

sapphi-red opened this issue Jan 25, 2025 · 0 comments · Fixed by #8857
Assignees
Labels
C-enhancement Category - New feature or request

Comments

@sapphi-red
Copy link
Contributor

Compress

function z(a) {
  {
    for (var i = 0; i < a; i++) {}
    console.log()
  }
  console.log()
}

into

function z(a) {
  for (var i = 0; i < a; i++) {}
  console.log()
  console.log()
}

. This is safe because the block statement does not include lexical variable declarations.

If I remove the for loop or the console.log in the block, the block is inlined.

@sapphi-red sapphi-red added the C-enhancement Category - New feature or request label Jan 25, 2025
@Boshen Boshen self-assigned this Jan 25, 2025
Boshen added a commit that referenced this issue Feb 3, 2025
Boshen added a commit that referenced this issue Feb 3, 2025
Boshen added a commit that referenced this issue Feb 3, 2025
Boshen added a commit that referenced this issue Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants