diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-20 19:50:41 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-20 19:50:41 +0100 |
commit | 18350159ad39c25d8acf6d9abdc4084592d58a21 (patch) | |
tree | 7fff0c63ff7d81581954cb69d9553a7ad7006b4a /src/js/javascript.nim | |
parent | d8ff191ee73753e75abcaac92fa3128413da4251 (diff) | |
download | chawan-18350159ad39c25d8acf6d9abdc4084592d58a21.tar.gz |
Fix JS_GetPropertyNames bindings
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r-- | src/js/javascript.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index c0c55237..876f7127 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -515,7 +515,7 @@ proc fromJSTable[A, B](ctx: JSContext, val: JSValue): Option[Table[A, B]] = var ptab: ptr JSPropertyEnum var plen: uint32 let flags = cint(JS_GPN_STRING_MASK) - if JS_GetOwnPropertyNames(ctx, addr ptab, addr plen, val, flags) < -1: + if JS_GetOwnPropertyNames(ctx, addr ptab, addr plen, val, flags) == -1: # exception return none(Table[A, B]) defer: @@ -744,6 +744,8 @@ proc toJS*[T](ctx: JSContext, obj: T): JSValue = return a elif T is enum: return toJS(ctx, int(obj)) + elif T is JSValue: + return obj else: if obj == nil: return JS_NULL |