fix(es/minifier): Use log instead of stderr (#1715)

This commit is contained in:
강동윤 2021-05-20 14:23:01 +09:00 committed by GitHub
parent c6b22c57f8
commit ded8f2b5e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,19 +125,22 @@ impl VisitMut for Compressor<'_> {
fn visit_mut_module(&mut self, n: &mut Module) {
if self.options.passes != 0 && self.options.passes + 1 <= self.pass {
let done = dump(&*n);
eprintln!("===== Done =====\n{}", done);
log::trace!("===== Done =====\n{}", done);
return;
}
dbg!(self.pass);
// Temporary
if self.pass > 10 {
panic!("Infinite loop detected")
}
let start = dump(&*n);
eprintln!("===== Start =====\n{}", start);
let start = if cfg!(debug_assertions) {
let start = dump(&*n);
log::trace!("===== Start =====\n{}", start);
start
} else {
String::new()
};
{
let mut visitor = expr_simplifier();
@ -145,7 +148,7 @@ impl VisitMut for Compressor<'_> {
self.changed |= visitor.changed();
if visitor.changed() {
log::trace!("compressor: Simplified expressions");
eprintln!("===== Simplified =====\n{}", dump(&*n));
log::trace!("===== Simplified =====\n{}", dump(&*n));
}
if cfg!(debug_assertions) && !visitor.changed() {