fix(es/minifier): Fix infinite loop (#2424)

swc_ecma_minifier:
 - Prevent infinite loop of post-optimize inliner.
This commit is contained in:
Donny/강동윤 2021-10-13 19:26:47 +09:00 committed by GitHub
parent 8074c72ce9
commit aff6670856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

4
Cargo.lock generated
View File

@ -2674,7 +2674,7 @@ dependencies = [
[[package]]
name = "swc_ecma_minifier"
version = "0.37.3"
version = "0.37.4"
dependencies = [
"ansi_term 0.12.1",
"anyhow",
@ -2783,7 +2783,7 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_base"
version = "0.37.2"
version = "0.37.3"
dependencies = [
"once_cell",
"phf",

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
license = "Apache-2.0/MIT"
name = "swc_ecma_minifier"
repository = "https://github.com/swc-project/swc.git"
version = "0.37.3"
version = "0.37.4"
[features]
debug = ["backtrace"]

View File

@ -210,13 +210,12 @@ impl VisitMut for MultiReplacer {
}
items.visit_mut_children_with(self);
if self.changed {
continue;
}
if cfg!(feature = "debug") {
let keys = self.vars.iter().map(|(k, _)| k.clone()).collect::<Vec<_>>();
debug!("Left: {:?}", keys);
if !self.changed {
if cfg!(feature = "debug") {
let keys = self.vars.iter().map(|(k, _)| k.clone()).collect::<Vec<_>>();
debug!("Dropping {:?}", keys);
}
break;
}
}
}