diff options
author | bptato <nincsnevem662@gmail.com> | 2023-10-14 16:32:40 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-10-14 16:32:40 +0200 |
commit | 204ec2eb1fee0a02f83b6f7ac16a0da1a3238f21 (patch) | |
tree | 163ba0011db16dbb0552616a56ab5639c46c9834 /src/js | |
parent | 15461c544e9718fde1e2627c082e91e848fe8d42 (diff) | |
download | chawan-204ec2eb1fee0a02f83b6f7ac16a0da1a3238f21.tar.gz |
XHR progress
still non-functional
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/javascript.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index 0d49cf86..c744345d 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -816,7 +816,7 @@ proc addThisName(gen: var JSFuncGenerator, thisname: Option[string]) = func getActualMinArgs(gen: var JSFuncGenerator): int = var ma = gen.minArgs - if gen.thisname.isSome: + if gen.thisname.isSome and not gen.isstatic: dec ma if gen.passCtx: dec ma @@ -1038,9 +1038,10 @@ macro jsfuncn*(jsname: static string, uf: static bool, staticname: static string, fun: typed) = var gen = setupGenerator(fun, FUNCTION, jsname = jsname, unforgeable = uf, isstatic = staticname != "", thisType = staticname) - if gen.minArgs == 0: + if gen.minArgs == 0 and not gen.isstatic: error("Zero-parameter functions are not supported. (Maybe pass Window or Client?)") - gen.addFixParam("this") + if not gen.isstatic: + gen.addFixParam("this") gen.addRequiredParams() gen.addOptionalParams() gen.finishFunCallList() |