Skip to content

Commit

Permalink
Added converter to upcast JSObj
Browse files Browse the repository at this point in the history
  • Loading branch information
yglukhov committed Jul 28, 2023
1 parent e2b977e commit 4424eab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wasmrt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ when not defined(release):
writeStackTrace()
raise newException(Exception, "")

proc to*(o: sink JSObj, T: typedesc[JSObj]): T {.inline.} =
let r = o.o
wasMoved(o)
T(o: r)

# Return type
# R - 4 - 0 return void, 1 as is, 2 obj, 3 string
# F - 2 - 0 dont prepend first arg, 1 prepend
Expand Down

0 comments on commit 4424eab

Please sign in to comment.