Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
levi-nz committed Jul 11, 2024
1 parent af1906d commit bb7ea9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,14 @@ fn test_unary_ops_5() {
fold("+[]", "0");
fold("+[[]]", "0");
fold("+[[[]]]", "0");

// Arrays with one element
fold("+[1]", "1");
fold("+[[1]]", "1");
fold("+[undefined]", "0");
fold("+[null]", "0");
fold("+[,]", "0");

// Arrays with more than one element
fold("+[1, 2]", "NaN");
fold("+[[1], 2]", "NaN");
Expand Down
4 changes: 2 additions & 2 deletions crates/swc_ecma_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,9 @@ pub trait ExprExt {
let Known(s) = self.as_pure_string(ctx) else {
return (Pure, Unknown);
};

return (Pure, num_from_str(&s));
},
}
Expr::Ident(Ident { sym, span, .. }) => match &**sym {
"undefined" | "NaN" if span.ctxt == ctx.unresolved_ctxt => f64::NAN,
"Infinity" if span.ctxt == ctx.unresolved_ctxt => f64::INFINITY,
Expand Down

0 comments on commit bb7ea9d

Please sign in to comment.