mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-03 12:34:44 +00:00
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:
@@ -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'"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user