Skip to content

Commit

Permalink
feat(minifier): {} evals to f64::NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jan 5, 2025
1 parent 4d8a08d commit cec63e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/oxc_ecmascript/src/constant_evaluation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub trait ConstantEvaluation<'a> {
Expression::SequenceExpression(s) => {
s.expressions.last().and_then(|e| self.eval_to_number(e))
}
Expression::ObjectExpression(e) if e.properties.is_empty() => Some(f64::NAN),
expr => {
use crate::ToNumber;
expr.to_number()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,7 @@ mod test {
test("~true", "-2");
test("~'1'", "-2");
test("~'-1'", "0");
test("~{}", "-1");
}

#[test]
Expand Down

0 comments on commit cec63e2

Please sign in to comment.