Skip to content

Commit 7e381bc

Browse files
committed
eval void 0 to undefined
1 parent c434319 commit 7e381bc

File tree

1 file changed

+6
-0
lines changed
  • turbopack/crates/turbopack-ecmascript/src/analyzer

1 file changed

+6
-0
lines changed

turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,12 @@ impl EvalContext {
418418
Expr::Lit(e) => JsValue::Constant(e.clone().into()),
419419
Expr::Ident(i) => self.eval_ident(i),
420420

421+
Expr::Unary(UnaryExpr {
422+
op: op!("void"),
423+
arg: box Expr::Lit(Lit::Num(num)),
424+
..
425+
}) if num.value == 0.0 => JsValue::Constant(ConstantValue::Undefined),
426+
421427
Expr::Unary(UnaryExpr {
422428
op: op!("!"), arg, ..
423429
}) => {

0 commit comments

Comments
 (0)