aboutsummaryrefslogtreecommitdiffstats
path: root/src/bindings
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-19 10:02:54 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-20 15:39:07 +0200
commit65ad7f9fc8b69140c050006fbe9ea1644bc283d8 (patch)
treeb2e8b654c31ba6fe66992014c3eefeb0b731b3e2 /src/bindings
parent01dfb3abe8d3a282a127aafd34e55fff1ff9d2df (diff)
downloadchawan-65ad7f9fc8b69140c050006fbe9ea1644bc283d8.tar.gz
javascript: update Events, misc fixes & additions
Events: just implement the interfaces, no events are triggered yet. JS changes: * add LegacyUnforgeable * make consts enumerable * fix crash in isInstanceOf * fix destructor warnings * refactor registerType As a result, peakmem is now 1G+ on 1.6.14. It stays ~750M on 2.0.0. Hmm. Well, better upgrade to 2.0.0 I guess.
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/quickjs.nim18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim
index d415c17e..9db75a05 100644
--- a/src/bindings/quickjs.nim
+++ b/src/bindings/quickjs.nim
@@ -262,7 +262,8 @@ const
const
JS_PARSE_JSON_EXT* = (1 shl 0)
-template JS_CFUNC_DEF*(n: string, len: uint8, func1: JSCFunction): JSCFunctionListEntry =
+template JS_CFUNC_DEF*(n: string, len: uint8, func1: JSCFunction):
+ JSCFunctionListEntry =
JSCFunctionListEntry(name: cstring(n),
prop_flags: JS_PROP_WRITABLE or JS_PROP_CONFIGURABLE,
def_type: JS_DEF_CFUNC,
@@ -272,7 +273,8 @@ template JS_CFUNC_DEF*(n: string, len: uint8, func1: JSCFunction): JSCFunctionLi
cproto: JS_CFUNC_generic,
cfunc: JSCFunctionType(generic: func1))))
-template JS_CGETSET_DEF*(n: string, fgetter, fsetter: untyped): JSCFunctionListEntry =
+template JS_CGETSET_DEF*(n: string, fgetter: JSGetterFunction,
+ fsetter: JSSetterFunction): JSCFunctionListEntry =
JSCFunctionListEntry(name: cstring(n),
prop_flags: JS_PROP_CONFIGURABLE,
def_type: JS_DEF_CGETSET,
@@ -281,7 +283,17 @@ 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,
+template JS_CGETSET_DEF_NOCONF*(n: string, fgetter: JSGetterFunction,
+ fsetter: JSSetterFunction): JSCFunctionListEntry =
+ JSCFunctionListEntry(name: cstring(n),
+ prop_flags: JS_PROP_ENUMERABLE,
+ def_type: JS_DEF_CGETSET,
+ u: JSCFunctionListEntryU(
+ getset: JSCFunctionListEntryGetSet(
+ get: JSCFunctionType(getter: fgetter),
+ set: JSCFunctionType(setter: fsetter))))
+
+template JS_CGETSET_MAGIC_DEF*(n: string, fgetter, fsetter: typed,
m: int16): JSCFunctionListEntry =
JSCFunctionListEntry(name: cstring(n),
prop_flags: JS_PROP_CONFIGURABLE,