array literals uses typed arrays; fix a jsgen bug (#16850)
* array litterals uses typed arrays * Update compiler/jsgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
parent
c8d9963150
commit
240879bf3d
6 changed files with 81 additions and 31 deletions
|
|
@ -23,8 +23,16 @@ when defined(js):
|
|||
func `[]=`*(arr: Float64Array, i: int, v: float) {.importjs: "#[#] = #".}
|
||||
|
||||
|
||||
proc jsTypeOf*[T](x: T): cstring {.importjs: "typeof(#)".}
|
||||
## Returns the name of the JsObject's JavaScript type as a cstring.
|
||||
# xxx replace jsffi.jsTypeOf with this definition and add tests
|
||||
|
||||
proc jsConstructorName*[T](a: T): cstring =
|
||||
asm """`result` = `a`.constructor.name"""
|
||||
|
||||
proc hasJsBigInt*(): bool =
|
||||
asm """`result` = typeof BigInt != 'undefined'"""
|
||||
|
||||
proc hasBigUint64Array*(): bool =
|
||||
asm """`result` = typeof BigUint64Array != 'undefined'"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue