Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8912,7 +8912,13 @@ static inline JS_BOOL JS_IsNumber(JSValueConst v)
return tag == JS_TAG_INT || JS_TAG_IS_FLOAT64(tag);
}

static inline JS_BOOL JS_IsBigInt(JSContext *ctx, JSValueConst v)
static inline JS_BOOL JS_IsInteger(JSValueConst v)
{
int tag = JS_VALUE_GET_TAG(v);
return tag == JS_TAG_INT;
}

static inline JS_BOOL JS_IsBigInt(JSValueConst v)
{
int tag = JS_VALUE_GET_TAG(v);
return tag == JS_TAG_BIG_INT;
Expand Down Expand Up @@ -20782,7 +20788,7 @@ inline int JS_ToInt64(JSContext *ctx, int64_t *pres, JSValueConst val)

inline int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val)
{
if (JS_IsBigInt(ctx, val))
if (JS_IsBigInt(val))
return JS_ToBigInt64(ctx, pres, val);
else
return JS_ToInt64(ctx, pres, val);
Expand Down
19 changes: 16 additions & 3 deletions modules/juce_javascript/detail/juce_QuickJSHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,22 @@ static var tryQuickJSToJuce (const qjs::QuickJSContext::ValuePtr& ptr,

if (JS_IsNumber (ptr.value))
{
double d = 0;
JS_ToFloat64 (ptr.context, std::addressof (d), ptr.value);
return d;
if(JS_IsBigInt(ptr.value))
{
int64_t i = 0;
JS_ToBigInt64 (ptr.context, std::addressof (i), ptr.value);
return var((juce::int64)i);
}if(JS_IsInteger(ptr.value))
{
int32_t i = 0;
JS_ToInt32 (ptr.context, std::addressof (i), ptr.value);
return i;
}
{
double d = 0;
JS_ToFloat64 (ptr.context, std::addressof (d), ptr.value);
return d;
}
}

if (JS_IsBool (ptr.value))
Expand Down