about summary refs log tree commit diff stats
path: root/src/js/javascript.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-26 18:50:20 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-26 18:50:20 +0100
commit636ddbb788a4a4dcd4dc4bc247159b6bb191ef8a (patch)
tree51a262f8455922718b0142e17ab76dee08c042d3 /src/js/javascript.nim
parente694c62b4630a8373ff324b4d3480c067220e480 (diff)
downloadchawan-636ddbb788a4a4dcd4dc4bc247159b6bb191ef8a.tar.gz
DOM: implement many new methods
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r--src/js/javascript.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index d7ccc115..bf81a09d 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -1240,9 +1240,13 @@ proc rewriteExceptions(gen: var JSFuncGenerator, errors: var seq[string], node:
     if c.kind == nnkCommand and c[0].eqIdent ident("JS_ERR"):
       if gen.copied == nil:
         gen.copied = copy(gen.original)
-      node[i] = quote do:
-        zeroMem(addr result, sizeof(result))
-        return
+      if gen.returnType.isSome:
+        node[i] = quote do:
+          zeroMem(addr result, sizeof(result))
+          return
+      else:
+        node[i] = quote do:
+          return
       if c[1].strVal notin errors:
         errors.add(c[1].strVal)
     elif c.len > 0: