diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/quickjs.nim | 6 | ||||
-rw-r--r-- | src/js/javascript.nim | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim index 2d37a789..648abfb2 100644 --- a/src/bindings/quickjs.nim +++ b/src/bindings/quickjs.nim @@ -47,10 +47,10 @@ const ## all tags with a reference count are negative when sizeof(int) < sizeof(int64): {.passC: "-DJS_NAN_BOXING".} type - JSValue* {.importc, header: qjsheader.} = uint64 + JSValue* {.importc, header: qjsheader.} = distinct uint64 template JS_VALUE_GET_TAG*(v: untyped): int32 = - cast[int32](v shr 32) + cast[int32](cast[uint64](v) shr 32) template JS_VALUE_GET_PTR*(v: untyped): pointer = cast[pointer](v) @@ -60,6 +60,8 @@ when sizeof(int) < sizeof(int64): template JS_MKPTR*(t, p: untyped): JSValue = JSValue((cast[uint64](t) shl 32) or cast[uint](p)) + + proc `==`*(a, b: JSValue): bool {.borrow.} else: type JSValueUnion* {.importc, header: qjsheader, union.} = object diff --git a/src/js/javascript.nim b/src/js/javascript.nim index f13305c7..f3193199 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -56,6 +56,9 @@ export JS_GetGlobalObject, JS_FreeValue, JS_IsException, JS_GetPropertyStr, JS_IsFunction, JS_NewCFunctionData, JS_Call, JS_DupValue +when sizeof(int) < sizeof(int64): + export quickjs.`==` + type JSContextOpaque* = ref object creg: Table[string, JSClassID] |