fix JS_ToNumber

This commit is contained in:
2026-02-18 14:14:44 -06:00
parent 91b73f923a
commit 4872c62704

View File

@@ -3955,8 +3955,10 @@ JSValue JS_ToNumber (JSContext *ctx, JSValue val) {
ret = val;
break;
case JS_TAG_BOOL:
ret = JS_NewInt32 (ctx, JS_ToBool (ctx, val));
break;
case JS_TAG_NULL:
ret = JS_NewInt32 (ctx, JS_VALUE_GET_INT (val));
ret = JS_NewInt32 (ctx, 0);
break;
case JS_TAG_STRING_IMM:
return JS_ThrowTypeError (ctx, "cannot convert text to a number");