diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-05-10 14:21:26 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-05-10 14:21:26 +0200 |
| commit | a2576992a14d922279c3014d6a8895d39e1c1244 (patch) | |
| tree | c0c198e6d99ba68fcc5ed830a3f10f29958931a5 /lib/monoucha0 | |
| parent | fdbfa8a46acd2b2971c849875d000e1f94843cf3 (diff) | |
| download | chawan-a2576992a14d922279c3014d6a8895d39e1c1244.tar.gz | |
Enable ProveInit warning
It has caught some minor bugs.
Diffstat (limited to 'lib/monoucha0')
| -rw-r--r-- | lib/monoucha0/monoucha/fromjs.nim | 4 | ||||
| -rw-r--r-- | lib/monoucha0/monoucha/tojs.nim | 3 |
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) |