Skip to content

Commit 2667263

Browse files
committed
[js] Add int32 to int64 and uint64 coercions
1 parent df76dc7 commit 2667263

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/vm/js/Compiler.nqp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,12 +744,18 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
744744
if $got == $T_INT64 {
745745
return Chunk.new($T_UINT64, "nqp.asUintN(64, {$chunk.expr})", $chunk);
746746
}
747+
if $got == $T_INT {
748+
return Chunk.new($T_UINT64, "nqp.BigInt({$chunk.expr} >>> 0)", $chunk);
749+
}
747750
}
748751

749752
if $desired == $T_INT64 {
750753
if $got == $T_UINT64 {
751754
return Chunk.new($T_INT64, "nqp.asIntN(64, {$chunk.expr})", $chunk);
752755
}
756+
if $got == $T_INT {
757+
return Chunk.new($T_INT64, "nqp.BigInt({$chunk.expr})", $chunk);
758+
}
753759
}
754760

755761
if self.is_fancy_int($desired) {

0 commit comments

Comments
 (0)