Skip to content

Commit 02b5219

Browse files
author
Mike Pall
committed
FFI: Add tonumber() specialization for failed conversions.
Contributed by Javier Guerra Giraldez.
1 parent 046129d commit 02b5219

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lj_crecord.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,8 @@ void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd)
16611661
d = ctype_get(cts, CTID_DOUBLE);
16621662
J->base[0] = crec_ct_tv(J, d, 0, J->base[0], &rd->argv[0]);
16631663
} else {
1664+
/* Specialize to the ctype that couldn't be converted. */
1665+
argv2cdata(J, J->base[0], &rd->argv[0]);
16641666
J->base[0] = TREF_NIL;
16651667
}
16661668
}

0 commit comments

Comments
 (0)