From af3dbce840d0d0956663ffb20012329a4c22d5dd Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 1 Aug 2023 19:05:45 +0200 Subject: Fixes & workarounds to compile on Nim 2.0.0 * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.) --- src/bindings/curl.nim | 2 ++ src/bindings/quickjs.nim | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/bindings') diff --git a/src/bindings/curl.nim b/src/bindings/curl.nim index 07395b65..ed2057eb 100644 --- a/src/bindings/curl.nim +++ b/src/bindings/curl.nim @@ -286,7 +286,9 @@ type CURLMSG_LAST # last, not used proc `==`*(a: CURL, b: CURL): bool {.borrow.} +proc `==`*(a: CURL, b: typeof(nil)): bool {.borrow.} proc `==`*(a: CURLM, b: CURLM): bool {.borrow.} +proc `==`*(a: CURLM, b: typeof(nil)): bool {.borrow.} {.push importc.} diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim index 7ff8fd0f..d415c17e 100644 --- a/src/bindings/quickjs.nim +++ b/src/bindings/quickjs.nim @@ -281,7 +281,8 @@ template JS_CGETSET_DEF*(n: string, fgetter, fsetter: untyped): JSCFunctionListE get: JSCFunctionType(getter: fgetter), set: JSCFunctionType(setter: fsetter)))) -template JS_CGETSET_MAGIC_DEF*(n: string, fgetter, fsetter: untyped, m: cint): JSCFunctionListEntry = +template JS_CGETSET_MAGIC_DEF*(n: string, fgetter, fsetter: untyped, + m: int16): JSCFunctionListEntry = JSCFunctionListEntry(name: cstring(n), prop_flags: JS_PROP_CONFIGURABLE, def_type: JS_DEF_CGETSET_MAGIC, -- cgit 1.4.1-2-gfad0