summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-30 07:14:38 -0600
committerGitHub <noreply@github.com>2021-01-30 14:14:38 +0100
commit111092e8aa4817c5a62a2da95bdf0b487c21f8fb (patch)
treec2fa5bb5e9e0c2963e56144000d4de2407317c61 /lib/std
parentb8e8eaae66c3298d25a324e939ca6c1fd69a9652 (diff)
downloadNim-111092e8aa4817c5a62a2da95bdf0b487c21f8fb.tar.gz
refactor hash in JS backend (#16863)
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/private/jsutils.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/private/jsutils.nim b/lib/std/private/jsutils.nim
index cc463ac74..296533a49 100644
--- a/lib/std/private/jsutils.nim
+++ b/lib/std/private/jsutils.nim
@@ -1,12 +1,20 @@
 when defined(js):
+  import std/jsbigints
+
   type
     ArrayBuffer* = ref object of JsRoot
     Float64Array* = ref object of JsRoot
     Uint32Array* = ref object of JsRoot
+    BigUint64Array* = ref object of JsRoot
 
   func newArrayBuffer*(n: int): ArrayBuffer {.importjs: "new ArrayBuffer(#)".}
   func newFloat64Array*(buffer: ArrayBuffer): Float64Array {.importjs: "new Float64Array(#)".}
   func newUint32Array*(buffer: ArrayBuffer): Uint32Array {.importjs: "new Uint32Array(#)".}
+  func newBigUint64Array*(buffer: ArrayBuffer): BigUint64Array {.importjs: "new BigUint64Array(#)".}
 
   func `[]`*(arr: Uint32Array, i: int): uint32 {.importjs: "#[#]".}
+  func `[]`*(arr: BigUint64Array, i: int): JsBigInt {.importjs: "#[#]".}
   func `[]=`*(arr: Float64Array, i: int, v: float) {.importjs: "#[#] = #".}
+
+  proc hasJsBigInt*(): bool =
+    asm """`result` = typeof BigInt != 'undefined'"""