diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-20 00:25:16 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-20 00:25:49 +0100 |
commit | 0cfe40914404aea4df691cfb9a1f8486381268ed (patch) | |
tree | 0e0757f65448620e9d623516bb78c5703d9c72a2 /src/js/javascript.nim | |
parent | 941f7e43b5cb7ebf6b84c3fb758ef2f1a5f641a3 (diff) | |
download | chawan-0cfe40914404aea4df691cfb9a1f8486381268ed.tar.gz |
Incremental loading of text files, etc.
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r-- | src/js/javascript.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index 08639aa9..11bcb65d 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -209,7 +209,9 @@ func getOpaque*(ctx: JSContext, val: JSValue, class: string): pointer = let opaque = JS_GetOpaque(global.val, 1) # JS_CLASS_OBJECT free(global) return opaque - return JS_GetOpaque(val, val.getClassID()) + if JS_VALUE_GET_TAG(val) == JS_TAG_OBJECT: + return JS_GetOpaque(val, val.getClassID()) + return nil func getOpaque*(obj: JSObject, class: string): pointer = getOpaque(obj.ctx, obj.val, class) @@ -236,6 +238,7 @@ proc writeException*(ctx: JSContext, s: Stream) = let str = toString(ctx, stack) if str.issome: s.write(str.get) + s.flush() JS_FreeValue(ctx, stack) JS_FreeValue(ctx, ex) |