about summary refs log tree commit diff stats
path: root/src/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-06 20:23:28 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-06 20:28:15 +0200
commit1e2cfd58f0fa5e063d7a36da918ec2523474b66e (patch)
tree44729ec09d9e4aff1bfe6230a8be3f445646601e /src/js
parent95566264c474935d6e010adfcb4a7f8daf1ad812 (diff)
downloadchawan-1e2cfd58f0fa5e063d7a36da918ec2523474b66e.tar.gz
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...)
Diffstat (limited to 'src/js')
-rw-r--r--src/js/javascript.nim4
-rw-r--r--src/js/tojs.nim3
2 files changed, 3 insertions, 4 deletions
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]))