mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(minifier): {} evals to f64::NaN
This commit is contained in:
parent
4d8a08d2ac
commit
cec63e2119
2 changed files with 2 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -1450,6 +1450,7 @@ mod test {
|
|||
test("~true", "-2");
|
||||
test("~'1'", "-2");
|
||||
test("~'-1'", "0");
|
||||
test("~{}", "-1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue