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): Fix analysis of var declaration after usage #6043
Conversation
Pull request was converted to draft
There was a problem hiding this 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
tracing::debug!("Scanning: `{}` with delta {}", considered, delta); | ||
} | ||
} | ||
// #[cfg(feature = "debug")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented this out as this disturbs debugging
@@ -34,6 +34,23 @@ impl VisitMut for PrecompressOptimizer { | |||
} | |||
} | |||
|
|||
fn visit_mut_pat_or_expr(&mut self, n: &mut PatOrExpr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a small normalization to reduce possibility of bugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by you're wording in the OP. Everything appears to be declared before use, when does an item get inserted into vars?
I meant
|
Anyway, thank you! |
There was a problem hiding this 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
Description:
var_initialized
should betrue
even if the declaration of variable comes after its usage.Related issue: