From 1e2cfd58f0fa5e063d7a36da918ec2523474b66e Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 6 May 2024 20:23:28 +0200 Subject: js: fix compilation on 1.6.14 * resolve empty promises without params, not a single undefined param (we can't just unsafeAddr constants on 1.6.14, and I don't see why we need to pass undefined?) * same in client with InternalError * explicitly convert static `asglobal' to bool (1.6.14 turns unquoted enums into ints...) --- src/js/javascript.nim | 4 ++-- src/js/tojs.nim | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/js') diff --git a/src/js/javascript.nim b/src/js/javascript.nim index e99dd481..90694e93 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -1642,8 +1642,8 @@ macro registerType*(ctx: typed; t: typed; parent: JSClassID = 0; let staticfuns = info.tabStatic endstmts.add(quote do: `ctx`.newJSClass(`classDef`, `tname`, getTypePtr(`t`), `sctr`, `tabList`, - `parent`, `asglobal`, `nointerface`, `finName`, `namespace`, `errid`, - `unforgeable`, `staticfuns`, `ishtmldda`) + `parent`, bool(`asglobal`), `nointerface`, `finName`, `namespace`, + `errid`, `unforgeable`, `staticfuns`, `ishtmldda`) ) stmts.add(newBlockStmt(endstmts)) return stmts diff --git a/src/js/tojs.nim b/src/js/tojs.nim index f625ab98..4090757d 100644 --- a/src/js/tojs.nim +++ b/src/js/tojs.nim @@ -324,8 +324,7 @@ proc toJS(ctx: JSContext; promise: EmptyPromise): JSValue = if JS_IsException(jsPromise): return JS_EXCEPTION promise.then(proc() = - let res = JS_Call(ctx, resolving_funcs[0], JS_UNDEFINED, 1, - JS_UNDEFINED.toJSValueArray()) + let res = JS_Call(ctx, resolving_funcs[0], JS_UNDEFINED, 0, nil) JS_FreeValue(ctx, res) JS_FreeValue(ctx, resolving_funcs[0]) JS_FreeValue(ctx, resolving_funcs[1])) -- cgit 1.4.1-2-gfad0