From: Mike Pall Date: Sun, 22 Apr 2018 11:27:25 +0000 (+0200) Subject: FFI: Add tonumber() specialization for failed conversions. X-Git-Tag: v2.1.ROLLING~324^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02b521981a1ab919ff2cd4d9bcaee80baf77dce2;p=thirdparty%2FLuaJIT.git FFI: Add tonumber() specialization for failed conversions. Contributed by Javier Guerra Giraldez. --- diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 84fc49ee..bc88d635 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c @@ -1661,6 +1661,8 @@ void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd) d = ctype_get(cts, CTID_DOUBLE); J->base[0] = crec_ct_tv(J, d, 0, J->base[0], &rd->argv[0]); } else { + /* Specialize to the ctype that couldn't be converted. */ + argv2cdata(J, J->base[0], &rd->argv[0]); J->base[0] = TREF_NIL; } }