about summary refs log tree commit diff stats
path: root/src/bindings
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-20 16:01:06 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-20 16:50:46 +0200
commit230ad7876ed5f8f26dce02db0e3528a5539150f4 (patch)
treea6051dfaeb43ad45e6f92e171328fcf1d5580922 /src/bindings
parent65ad7f9fc8b69140c050006fbe9ea1644bc283d8 (diff)
downloadchawan-230ad7876ed5f8f26dce02db0e3528a5539150f4.tar.gz
javascript: finish LegacyUnforgeable + misc fixes
Add jsuffget, jsuffunc for setting LegacyUnforgeable on functions.

Misc fixes:
* define LegacyUnforgeable properties for native object shims
* replace some macros with templates
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/quickjs.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim
index 9db75a05..8110dc5c 100644
--- a/src/bindings/quickjs.nim
+++ b/src/bindings/quickjs.nim
@@ -273,6 +273,17 @@ template JS_CFUNC_DEF*(n: string, len: uint8, func1: JSCFunction):
                            cproto: JS_CFUNC_generic,
                            cfunc: JSCFunctionType(generic: func1))))
 
+template JS_CFUNC_DEF_NOCONF*(n: string, len: uint8, func1: JSCFunction):
+    JSCFunctionListEntry =
+  JSCFunctionListEntry(name: cstring(n),
+                       prop_flags: JS_PROP_ENUMERABLE,
+                       def_type: JS_DEF_CFUNC,
+                       u: JSCFunctionListEntryU(
+                         `func`: JSCFunctionListEntryFunc(
+                           length: len,
+                           cproto: JS_CFUNC_generic,
+                           cfunc: JSCFunctionType(generic: func1))))
+
 template JS_CGETSET_DEF*(n: string, fgetter: JSGetterFunction,
     fsetter: JSSetterFunction): JSCFunctionListEntry =
   JSCFunctionListEntry(name: cstring(n),