Skip to content

Commit

Permalink
More assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 18, 2022
1 parent da574ae commit f02b21d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/swc_ecma_minifier/src/lib.rs
Expand Up @@ -104,6 +104,8 @@ pub fn optimize(
let mut marks = Marks::new();
marks.unresolved_mark = extra.unresolved_mark;

debug_assert_valid(&m);

if let Some(defs) = options.compress.as_ref().map(|c| &c.global_defs) {
let _timer = timer!("inline global defs");
// Apply global defs.
Expand Down Expand Up @@ -166,6 +168,7 @@ pub fn optimize(
let _timer = timer!("precompress");

m.visit_mut_with(&mut precompress_optimizer());
debug_assert_valid(&m);
}

if options.compress.is_some() {
Expand All @@ -175,6 +178,7 @@ pub fn optimize(
marks,
extra.unresolved_mark,
));
debug_assert_valid(&m);
}
m.visit_mut_with(&mut unique_scope());

Expand All @@ -192,7 +196,8 @@ pub fn optimize(
}
if let Some(options) = &options.compress {
if options.unused {
perform_dce(&mut m, options, extra)
perform_dce(&mut m, options, extra);
debug_assert_valid(&m);
}
}

Expand Down

0 comments on commit f02b21d

Please sign in to comment.