Skip to content

Commit 3909a48

Browse files
committed
[js] NaN is true in nqp
1 parent 2397473 commit 3909a48

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/vm/js/Compiler.nqp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,10 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
598598
}
599599

600600
if $desired == $T_BOOL {
601-
if $got == $T_INT || $got == $T_NUM {
601+
if $got == $T_INT {
602602
return Chunk.new($T_BOOL, $chunk.expr, $chunk);
603+
} elsif $got == $T_NUM {
604+
return Chunk.new($T_BOOL, "({$chunk.expr} !== 0)", $chunk);
603605
} elsif $got == $T_STR {
604606
return Chunk.new($T_BOOL, "({$chunk.expr} && {$chunk.expr} !== nqp.null_s)", $chunk);
605607
}

0 commit comments

Comments
 (0)