aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-01 23:26:17 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-01 23:26:17 +0200
commit2f74b628f3c91860860cc19fc07db5c304e8e6ed (patch)
tree161bd11827648bd89042ccb30b7d6fdae523272d /src/js
parent2b10a9b7f61d58157f85c93e8e7b18b1e01e4b79 (diff)
downloadchawan-2f74b628f3c91860860cc19fc07db5c304e8e6ed.tar.gz
Use separate flag for adding getset instead of repr
Still a hack, but maybe more reliable?
Diffstat (limited to 'src/js')
-rw-r--r--src/js/javascript.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index b2334be6..3e6eec14 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -1743,6 +1743,7 @@ template jsDestructor*[U](T: typedesc[ref U]) =
macro registerType*(ctx: typed, t: typed, parent: JSClassID = 0,
asglobal = false, nointerface = false, name: static string = "",
+ has_extra_getset: static bool = false,
extra_getset: static openarray[TabGetSet] = [],
namespace: JSValue = JS_NULL, errid = opt(JSErrorEnum)): JSClassID =
result = newStmtList()
@@ -1832,11 +1833,10 @@ macro registerType*(ctx: typed, t: typed, parent: JSClassID = 0,
if k notin getters:
tabList.add(quote do: JS_CGETSET_DEF(`k`, nil, `v`))
- for x in extra_getset:
- #TODO TODO TODO what the hell is this...
- # For some reason, extra_getset gets weird contents when nothing is
+ if has_extra_getset:
+ #HACK: for some reason, extra_getset gets weird contents when nothing is
# passed to it.
- if repr(x) != "" and repr(x) != "[]":
+ for x in extra_getset:
let k = x.name
let g = x.get
let s = x.set