aboutsummaryrefslogtreecommitdiffstats
path: root/lib/monoucha0
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-05-10 14:21:26 +0200
committerbptato <nincsnevem662@gmail.com>2025-05-10 14:21:26 +0200
commita2576992a14d922279c3014d6a8895d39e1c1244 (patch)
treec0c198e6d99ba68fcc5ed830a3f10f29958931a5 /lib/monoucha0
parentfdbfa8a46acd2b2971c849875d000e1f94843cf3 (diff)
downloadchawan-a2576992a14d922279c3014d6a8895d39e1c1244.tar.gz
Enable ProveInit warning
It has caught some minor bugs.
Diffstat (limited to 'lib/monoucha0')
-rw-r--r--lib/monoucha0/monoucha/fromjs.nim4
-rw-r--r--lib/monoucha0/monoucha/tojs.nim3
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/monoucha0/monoucha/fromjs.nim b/lib/monoucha0/monoucha/fromjs.nim
index 2ee2da7b..2e6dd5dc 100644
--- a/lib/monoucha0/monoucha/fromjs.nim
+++ b/lib/monoucha0/monoucha/fromjs.nim
@@ -250,14 +250,14 @@ proc fromJS*[A, B](ctx: JSContext; val: JSValueConst; res: out Table[A, B]):
if not JS_IsObject(val):
if not JS_IsException(val):
JS_ThrowTypeError(ctx, "object expected")
- res = default(typeof(res))
+ res = default(Table[A, B])
return err()
var ptab: ptr UncheckedArray[JSPropertyEnum]
var plen: uint32
let flags = cint(JS_GPN_STRING_MASK)
if JS_GetOwnPropertyNames(ctx, addr ptab, addr plen, val, flags) == -1:
# exception
- res = default(typeof(res))
+ res = default(Table[A, B])
return err()
defer:
JS_FreePropertyEnum(ctx, ptab, plen)
diff --git a/lib/monoucha0/monoucha/tojs.nim b/lib/monoucha0/monoucha/tojs.nim
index 2b82116e..3c66fe73 100644
--- a/lib/monoucha0/monoucha/tojs.nim
+++ b/lib/monoucha0/monoucha/tojs.nim
@@ -371,8 +371,7 @@ proc toJSNew*[T, E](ctx: JSContext; opt: Result[T, E]; ctor: JSValueConst):
let res = toJS(ctx, opt.error)
if not JS_IsNull(res):
return JS_Throw(ctx, res)
- else:
- return JS_NULL
+ return JS_NULL
proc toJS(ctx: JSContext; e: enum): JSValue =
return toJS(ctx, $e)