Skip to content

Commit

Permalink
compress_array_join: Handle undefined in array literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 5, 2021
1 parent 0b633de commit 709d854
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ecmascript/minifier/src/compress/reduce_vars/mod.rs
Expand Up @@ -291,6 +291,7 @@ impl Reducer {
if arr.elems.iter().filter_map(|v| v.as_ref()).any(|v| {
v.spread.is_some()
|| match &*v.expr {
e if is_pure_undefind(e) => false,
Expr::Lit(lit) => match lit {
Lit::Str(..) | Lit::Num(..) | Lit::Null(..) => false,
_ => true,
Expand Down Expand Up @@ -326,6 +327,7 @@ impl Reducer {
Expr::Lit(Lit::Num(n)) => {
write!(res, "{}", n.value).unwrap();
}
e if is_pure_undefind(e) => {}
Expr::Lit(Lit::Null(..)) => {}
_ => {
unreachable!(
Expand Down

0 comments on commit 709d854

Please sign in to comment.