goscript 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/cmd/goscript/cmd-compile.go +7 -0
  2. package/cmd/goscript/cmd_compile_test.go +83 -0
  3. package/compiler/compile-request.go +3 -0
  4. package/compiler/compiler-cache.go +828 -0
  5. package/compiler/compiler-cache_test.go +705 -0
  6. package/compiler/config.go +2 -0
  7. package/compiler/index.test.ts +26 -1
  8. package/compiler/index.ts +5 -0
  9. package/compiler/lowered-program.go +31 -20
  10. package/compiler/lowering.go +349 -93
  11. package/compiler/lowering_bench_test.go +1 -0
  12. package/compiler/override-facts.go +309 -8
  13. package/compiler/override-parity-verifier.go +45 -1
  14. package/compiler/override-parity-verifier_test.go +100 -0
  15. package/compiler/override-registry_test.go +1 -0
  16. package/compiler/package-graph.go +40 -12
  17. package/compiler/package-graph_test.go +29 -0
  18. package/compiler/runtime-contract.go +8 -0
  19. package/compiler/service.go +98 -11
  20. package/compiler/skeleton_test.go +110 -14
  21. package/compiler/typescript-emitter.go +120 -23
  22. package/dist/compiler/index.d.ts +2 -0
  23. package/dist/compiler/index.js +3 -0
  24. package/dist/compiler/index.js.map +1 -1
  25. package/dist/gs/builtin/builtin.d.ts +24 -33
  26. package/dist/gs/builtin/builtin.js +54 -61
  27. package/dist/gs/builtin/builtin.js.map +1 -1
  28. package/dist/gs/builtin/hostio.d.ts +1 -0
  29. package/dist/gs/builtin/hostio.js +1 -1
  30. package/dist/gs/builtin/hostio.js.map +1 -1
  31. package/dist/gs/builtin/index.d.ts +1 -0
  32. package/dist/gs/builtin/index.js +1 -0
  33. package/dist/gs/builtin/index.js.map +1 -1
  34. package/dist/gs/builtin/panic.d.ts +18 -0
  35. package/dist/gs/builtin/panic.js +98 -0
  36. package/dist/gs/builtin/panic.js.map +1 -0
  37. package/dist/gs/builtin/slice.d.ts +10 -0
  38. package/dist/gs/builtin/slice.js +110 -53
  39. package/dist/gs/builtin/slice.js.map +1 -1
  40. package/dist/gs/builtin/type.js +15 -3
  41. package/dist/gs/builtin/type.js.map +1 -1
  42. package/dist/gs/builtin/varRef.d.ts +1 -1
  43. package/dist/gs/builtin/varRef.js +3 -2
  44. package/dist/gs/builtin/varRef.js.map +1 -1
  45. package/dist/gs/bytes/bytes.gs.js +51 -38
  46. package/dist/gs/bytes/bytes.gs.js.map +1 -1
  47. package/dist/gs/bytes/reader.gs.d.ts +1 -1
  48. package/dist/gs/bytes/reader.gs.js +6 -7
  49. package/dist/gs/bytes/reader.gs.js.map +1 -1
  50. package/dist/gs/cmp/index.d.ts +1 -1
  51. package/dist/gs/cmp/index.js +43 -10
  52. package/dist/gs/cmp/index.js.map +1 -1
  53. package/dist/gs/context/context.d.ts +2 -2
  54. package/dist/gs/context/context.js +1 -1
  55. package/dist/gs/context/context.js.map +1 -1
  56. package/dist/gs/embed/index.js +1 -1
  57. package/dist/gs/embed/index.js.map +1 -1
  58. package/dist/gs/encoding/binary/index.js +201 -8
  59. package/dist/gs/encoding/binary/index.js.map +1 -1
  60. package/dist/gs/encoding/json/index.d.ts +5 -0
  61. package/dist/gs/encoding/json/index.js +388 -25
  62. package/dist/gs/encoding/json/index.js.map +1 -1
  63. package/dist/gs/errors/errors.js +17 -24
  64. package/dist/gs/errors/errors.js.map +1 -1
  65. package/dist/gs/fmt/fmt.js +129 -35
  66. package/dist/gs/fmt/fmt.js.map +1 -1
  67. package/dist/gs/golang.org/x/crypto/cryptobyte/index.js +1 -1
  68. package/dist/gs/golang.org/x/crypto/cryptobyte/index.js.map +1 -1
  69. package/dist/gs/internal/bytealg/index.js +43 -8
  70. package/dist/gs/internal/bytealg/index.js.map +1 -1
  71. package/dist/gs/internal/byteorder/index.d.ts +2 -2
  72. package/dist/gs/internal/byteorder/index.js +2 -2
  73. package/dist/gs/internal/byteorder/index.js.map +1 -1
  74. package/dist/gs/io/fs/format.js +2 -2
  75. package/dist/gs/io/fs/format.js.map +1 -1
  76. package/dist/gs/io/fs/fs.d.ts +1 -1
  77. package/dist/gs/io/fs/fs.js +1 -1
  78. package/dist/gs/io/fs/fs.js.map +1 -1
  79. package/dist/gs/io/io.d.ts +21 -21
  80. package/dist/gs/io/io.js +49 -50
  81. package/dist/gs/io/io.js.map +1 -1
  82. package/dist/gs/math/bits/index.js +26 -8
  83. package/dist/gs/math/bits/index.js.map +1 -1
  84. package/dist/gs/math/copysign.gs.js +10 -17
  85. package/dist/gs/math/copysign.gs.js.map +1 -1
  86. package/dist/gs/math/pow.gs.js +5 -0
  87. package/dist/gs/math/pow.gs.js.map +1 -1
  88. package/dist/gs/math/signbit.gs.js +6 -2
  89. package/dist/gs/math/signbit.gs.js.map +1 -1
  90. package/dist/gs/mime/index.js +1 -0
  91. package/dist/gs/mime/index.js.map +1 -1
  92. package/dist/gs/net/http/index.d.ts +6 -6
  93. package/dist/gs/net/http/index.js +507 -43
  94. package/dist/gs/net/http/index.js.map +1 -1
  95. package/dist/gs/os/stat.gs.d.ts +2 -2
  96. package/dist/gs/os/types.gs.d.ts +1 -1
  97. package/dist/gs/os/types.gs.js +1 -1
  98. package/dist/gs/os/types.gs.js.map +1 -1
  99. package/dist/gs/os/types_js.gs.d.ts +1 -1
  100. package/dist/gs/os/types_js.gs.js +7 -7
  101. package/dist/gs/os/types_js.gs.js.map +1 -1
  102. package/dist/gs/os/types_unix.gs.d.ts +1 -1
  103. package/dist/gs/os/types_unix.gs.js +1 -1
  104. package/dist/gs/os/types_unix.gs.js.map +1 -1
  105. package/dist/gs/os/zero_copy_posix.gs.d.ts +1 -1
  106. package/dist/gs/os/zero_copy_posix.gs.js +1 -1
  107. package/dist/gs/os/zero_copy_posix.gs.js.map +1 -1
  108. package/dist/gs/path/filepath/match.js +8 -4
  109. package/dist/gs/path/filepath/match.js.map +1 -1
  110. package/dist/gs/path/filepath/path.js +216 -42
  111. package/dist/gs/path/filepath/path.js.map +1 -1
  112. package/dist/gs/path/match.js +6 -3
  113. package/dist/gs/path/match.js.map +1 -1
  114. package/dist/gs/reflect/type.d.ts +5 -4
  115. package/dist/gs/reflect/type.js +29 -11
  116. package/dist/gs/reflect/type.js.map +1 -1
  117. package/dist/gs/slices/slices.js +11 -11
  118. package/dist/gs/slices/slices.js.map +1 -1
  119. package/dist/gs/strconv/atof.gs.js +156 -43
  120. package/dist/gs/strconv/atof.gs.js.map +1 -1
  121. package/dist/gs/strconv/atoi.gs.d.ts +3 -2
  122. package/dist/gs/strconv/atoi.gs.js +86 -67
  123. package/dist/gs/strconv/atoi.gs.js.map +1 -1
  124. package/dist/gs/strconv/ftoa.gs.js +73 -3
  125. package/dist/gs/strconv/ftoa.gs.js.map +1 -1
  126. package/dist/gs/strconv/itoa.gs.d.ts +4 -4
  127. package/dist/gs/strconv/itoa.gs.js +5 -4
  128. package/dist/gs/strconv/itoa.gs.js.map +1 -1
  129. package/dist/gs/strconv/quote.gs.d.ts +1 -1
  130. package/dist/gs/strconv/quote.gs.js +311 -103
  131. package/dist/gs/strconv/quote.gs.js.map +1 -1
  132. package/dist/gs/strings/reader.d.ts +1 -1
  133. package/dist/gs/strings/reader.js +8 -8
  134. package/dist/gs/strings/reader.js.map +1 -1
  135. package/dist/gs/strings/strings.js +87 -61
  136. package/dist/gs/strings/strings.js.map +1 -1
  137. package/dist/gs/sync/atomic/doc_64.gs.d.ts +14 -14
  138. package/dist/gs/sync/atomic/doc_64.gs.js +10 -10
  139. package/dist/gs/sync/atomic/doc_64.gs.js.map +1 -1
  140. package/dist/gs/sync/atomic/type.gs.d.ts +22 -22
  141. package/dist/gs/sync/atomic/type.gs.js +4 -4
  142. package/dist/gs/sync/atomic/type.gs.js.map +1 -1
  143. package/dist/gs/sync/sync.js +50 -12
  144. package/dist/gs/sync/sync.js.map +1 -1
  145. package/dist/gs/syscall/fs.d.ts +6 -6
  146. package/dist/gs/syscall/fs.js +1 -1
  147. package/dist/gs/syscall/fs.js.map +1 -1
  148. package/dist/gs/time/time.d.ts +18 -18
  149. package/dist/gs/time/time.js +58 -55
  150. package/dist/gs/time/time.js.map +1 -1
  151. package/dist/gs/unicode/tables.d.ts +11 -0
  152. package/dist/gs/unicode/tables.js +635 -0
  153. package/dist/gs/unicode/tables.js.map +1 -0
  154. package/dist/gs/unicode/unicode.d.ts +58 -38
  155. package/dist/gs/unicode/unicode.js +362 -278
  156. package/dist/gs/unicode/unicode.js.map +1 -1
  157. package/go.sum +13 -0
  158. package/gs/builtin/builtin.ts +83 -93
  159. package/gs/builtin/hostio.ts +1 -1
  160. package/gs/builtin/index.ts +1 -0
  161. package/gs/builtin/panic.test.ts +189 -0
  162. package/gs/builtin/panic.ts +107 -0
  163. package/gs/builtin/runtime-contract.test.ts +5 -5
  164. package/gs/builtin/slice.test.ts +23 -0
  165. package/gs/builtin/slice.ts +133 -95
  166. package/gs/builtin/type.ts +16 -3
  167. package/gs/builtin/varRef.ts +4 -2
  168. package/gs/builtin/wide-int.test.ts +41 -0
  169. package/gs/bytes/bytes.gs.ts +54 -41
  170. package/gs/bytes/bytes.test.ts +18 -1
  171. package/gs/bytes/reader.gs.ts +7 -8
  172. package/gs/cmp/index.test.ts +55 -0
  173. package/gs/cmp/index.ts +45 -9
  174. package/gs/context/context.ts +3 -3
  175. package/gs/embed/index.ts +2 -2
  176. package/gs/encoding/binary/index.test.ts +104 -0
  177. package/gs/encoding/binary/index.ts +259 -11
  178. package/gs/encoding/json/index.test.ts +107 -0
  179. package/gs/encoding/json/index.ts +400 -29
  180. package/gs/errors/errors.test.ts +44 -1
  181. package/gs/errors/errors.ts +15 -31
  182. package/gs/fmt/fmt.test.ts +70 -2
  183. package/gs/fmt/fmt.ts +128 -34
  184. package/gs/golang.org/x/crypto/cryptobyte/index.ts +1 -1
  185. package/gs/internal/bytealg/index.test.ts +26 -1
  186. package/gs/internal/bytealg/index.ts +44 -8
  187. package/gs/internal/byteorder/index.ts +6 -4
  188. package/gs/io/fs/format.ts +2 -2
  189. package/gs/io/fs/fs.ts +2 -2
  190. package/gs/io/fs/stat.test.ts +2 -2
  191. package/gs/io/fs/sub.test.ts +2 -2
  192. package/gs/io/fs/walk.test.ts +2 -2
  193. package/gs/io/io.test.ts +47 -5
  194. package/gs/io/io.ts +73 -73
  195. package/gs/io/limit.test.ts +103 -0
  196. package/gs/math/bits/index.test.ts +128 -0
  197. package/gs/math/bits/index.ts +26 -8
  198. package/gs/math/copysign.gs.test.ts +3 -1
  199. package/gs/math/copysign.gs.ts +10 -22
  200. package/gs/math/pow.gs.test.ts +4 -5
  201. package/gs/math/pow.gs.ts +5 -0
  202. package/gs/math/signbit.gs.test.ts +2 -1
  203. package/gs/math/signbit.gs.ts +6 -3
  204. package/gs/mime/index.ts +1 -0
  205. package/gs/net/http/index.test.ts +683 -2
  206. package/gs/net/http/index.ts +598 -57
  207. package/gs/net/http/meta.json +3 -0
  208. package/gs/os/stat.gs.ts +2 -2
  209. package/gs/os/types.gs.ts +2 -2
  210. package/gs/os/types_js.gs.ts +9 -9
  211. package/gs/os/types_unix.gs.ts +2 -2
  212. package/gs/os/zero_copy_posix.gs.ts +2 -2
  213. package/gs/path/filepath/match.test.ts +16 -0
  214. package/gs/path/filepath/match.ts +8 -4
  215. package/gs/path/filepath/path.test.ts +91 -9
  216. package/gs/path/filepath/path.ts +223 -49
  217. package/gs/path/match.test.ts +32 -0
  218. package/gs/path/match.ts +6 -3
  219. package/gs/reflect/deepequal.test.ts +1 -1
  220. package/gs/reflect/field.test.ts +1 -1
  221. package/gs/reflect/function-types.test.ts +6 -6
  222. package/gs/reflect/sliceat.test.ts +13 -13
  223. package/gs/reflect/structof.test.ts +4 -4
  224. package/gs/reflect/type.ts +34 -14
  225. package/gs/reflect/typefor.test.ts +5 -5
  226. package/gs/runtime/pprof/index.test.ts +20 -0
  227. package/gs/runtime/trace/index.test.ts +3 -0
  228. package/gs/slices/slices.test.ts +31 -0
  229. package/gs/slices/slices.ts +11 -11
  230. package/gs/strconv/append.test.ts +99 -0
  231. package/gs/strconv/atof.gs.ts +156 -42
  232. package/gs/strconv/atof.test.ts +45 -0
  233. package/gs/strconv/atoi.gs.ts +87 -69
  234. package/gs/strconv/atoi.test.ts +49 -0
  235. package/gs/strconv/ftoa.gs.ts +85 -10
  236. package/gs/strconv/ftoa.test.ts +43 -0
  237. package/gs/strconv/itoa.gs.ts +10 -9
  238. package/gs/strconv/quote.gs.ts +335 -108
  239. package/gs/strconv/quote.test.ts +111 -0
  240. package/gs/strings/reader.test.ts +10 -10
  241. package/gs/strings/reader.ts +9 -9
  242. package/gs/strings/strings.test.ts +18 -5
  243. package/gs/strings/strings.ts +81 -68
  244. package/gs/sync/atomic/doc_64.gs.ts +24 -24
  245. package/gs/sync/atomic/doc_64.test.ts +5 -5
  246. package/gs/sync/atomic/type.gs.ts +28 -28
  247. package/gs/sync/sync.test.ts +109 -1
  248. package/gs/sync/sync.ts +46 -12
  249. package/gs/syscall/fs.ts +8 -8
  250. package/gs/syscall/net.test.ts +1 -1
  251. package/gs/time/parse.test.ts +45 -0
  252. package/gs/time/time.test.ts +46 -23
  253. package/gs/time/time.ts +69 -66
  254. package/gs/unicode/gen.go +198 -0
  255. package/gs/unicode/tables.ts +646 -0
  256. package/gs/unicode/unicode.test.ts +69 -0
  257. package/gs/unicode/unicode.ts +396 -312
  258. package/package.json +1 -1
  259. package/dist/gs/github.com/aperturerobotics/util/conc/index.d.ts +0 -20
  260. package/dist/gs/github.com/aperturerobotics/util/conc/index.js +0 -134
  261. package/dist/gs/github.com/aperturerobotics/util/conc/index.js.map +0 -1
  262. package/gs/github.com/aperturerobotics/util/conc/index.test.ts +0 -30
  263. package/gs/github.com/aperturerobotics/util/conc/index.ts +0 -172
  264. package/gs/github.com/aperturerobotics/util/conc/meta.json +0 -9
@@ -161,30 +161,30 @@ export class Reader {
161
161
  return null
162
162
  }
163
163
 
164
- // Seek implements the [io.Seeker] interface.
165
- public Seek(offset: number, whence: number): [number, $.GoError] {
164
+ // Seek implements the [io.Seeker] interface. offset is a Go int64 (bigint);
165
+ // the internal read index stays a number for string slicing.
166
+ public Seek(offset: bigint, whence: number): [bigint, $.GoError] {
166
167
  const r = this
167
168
  r!.prevRune = -1
168
169
  let abs: number
169
170
  switch (whence) {
170
171
  case io.SeekStart:
171
- abs = offset
172
+ abs = Number(offset)
172
173
  break
173
174
  case io.SeekCurrent:
174
- abs = r!.i + offset
175
+ abs = r!.i + Number(offset)
175
176
  break
176
177
  case io.SeekEnd:
177
- abs = ($.len(r!.s) as number) + offset
178
+ abs = ($.len(r!.s) as number) + Number(offset)
178
179
  break
179
180
  default:
180
- return [0, $.newError('strings.Reader.Seek: invalid whence')]
181
- break
181
+ return [0n, $.newError('strings.Reader.Seek: invalid whence')]
182
182
  }
183
183
  if (abs < 0) {
184
- return [0, $.newError('strings.Reader.Seek: negative position')]
184
+ return [0n, $.newError('strings.Reader.Seek: negative position')]
185
185
  }
186
186
  r!.i = abs
187
- return [abs, null]
187
+ return [BigInt(abs), null]
188
188
  }
189
189
 
190
190
  // WriteTo implements the [io.WriterTo] interface.
@@ -319,7 +319,17 @@ describe('strings', () => {
319
319
  )
320
320
  expect(Replace('hello world hello', 'hello', 'hi', 2)).toBe('hi world hi')
321
321
  expect(Replace('hello world', 'xyz', 'abc', 1)).toBe('hello world')
322
- expect(Replace('hello', '', 'x', 1)).toBe('hello')
322
+ })
323
+
324
+ it('matches Go for empty old, negative n, and remainder', () => {
325
+ // Empty old inserts at the start and after each rune, then appends the
326
+ // untouched remainder once the insertion limit is reached.
327
+ expect(Replace('abc', '', '-', 2)).toBe('-a-bc')
328
+ expect(Replace('abc', '', '-', -1)).toBe('-a-b-c-')
329
+ expect(Replace('hello', '', 'x', 1)).toBe('xhello')
330
+ // n < 0 replaces every occurrence, not none.
331
+ expect(Replace('aaa', 'a', 'b', -1)).toBe('bbb')
332
+ expect(Replace('a,b,c', ',', ';', -1)).toBe('a;b;c')
323
333
  })
324
334
  })
325
335
 
@@ -380,7 +390,8 @@ describe('strings', () => {
380
390
  describe('Title', () => {
381
391
  it('should convert to title case', () => {
382
392
  expect(Title('hello world')).toBe('Hello World')
383
- expect(Title('HELLO WORLD')).toBe('Hello World')
393
+ // Go's Title only title-cases word-initial letters; the rest is unchanged.
394
+ expect(Title('HELLO WORLD')).toBe('HELLO WORLD')
384
395
  expect(Title('')).toBe('')
385
396
  })
386
397
  })
@@ -411,9 +422,11 @@ describe('strings', () => {
411
422
 
412
423
  describe('special casing and UTF-8 cleanup', () => {
413
424
  it('should expose special-case string helpers', () => {
414
- expect(ToUpperSpecial([], 'hello')).toBe('HELLO')
415
- expect(ToLowerSpecial([], 'HELLO')).toBe('hello')
416
- expect(ToTitleSpecial([], 'hello world')).toBe('HELLO WORLD')
425
+ expect(ToUpperSpecial(new unicode.SpecialCase(), 'hello')).toBe('HELLO')
426
+ expect(ToLowerSpecial(new unicode.SpecialCase(), 'HELLO')).toBe('hello')
427
+ expect(ToTitleSpecial(new unicode.SpecialCase(), 'hello world')).toBe(
428
+ 'HELLO WORLD',
429
+ )
417
430
  expect(ToUpperSpecial(unicode.TurkishCase, 'iki')).toBe('İKİ')
418
431
  expect(ToLowerSpecial(unicode.TurkishCase, 'Iİ')).toBe('ıi')
419
432
  expect(ToTitleSpecial(unicode.TurkishCase, 'iki')).toBe('İKİ')
@@ -353,70 +353,32 @@ export function Repeat(s: string, count: number): string {
353
353
 
354
354
  // ToUpper returns s with all Unicode letters mapped to their upper case.
355
355
  export function ToUpper(s: string): string {
356
- return s.toUpperCase()
356
+ return Map(unicode.ToUpper, s)
357
357
  }
358
358
 
359
+ // ToUpperSpecial returns s with all Unicode letters mapped to their upper case using the case mapping specified by c.
359
360
  export function ToUpperSpecial(c: unicode.SpecialCase, s: string): string {
360
- if (isTurkishCase(c)) {
361
- return mapTurkishCase(s, 'upper')
362
- }
363
- return ToUpper(s)
361
+ return Map((r) => c.ToUpper(r), s)
364
362
  }
365
363
 
366
364
  // ToLower returns s with all Unicode letters mapped to their lower case.
367
365
  export function ToLower(s: string): string {
368
- return s.toLowerCase()
366
+ return Map(unicode.ToLower, s)
369
367
  }
370
368
 
369
+ // ToLowerSpecial returns s with all Unicode letters mapped to their lower case using the case mapping specified by c.
371
370
  export function ToLowerSpecial(c: unicode.SpecialCase, s: string): string {
372
- if (isTurkishCase(c)) {
373
- return mapTurkishCase(s, 'lower')
374
- }
375
- return ToLower(s)
371
+ return Map((r) => c.ToLower(r), s)
376
372
  }
377
373
 
378
374
  // ToTitle returns a copy of the string s with all Unicode letters mapped to their Unicode title case.
379
375
  export function ToTitle(s: string): string {
380
- return s.toUpperCase()
376
+ return Map(unicode.ToTitle, s)
381
377
  }
382
378
 
379
+ // ToTitleSpecial returns a copy of s with all Unicode letters mapped to their Unicode title case using the case mapping specified by c.
383
380
  export function ToTitleSpecial(c: unicode.SpecialCase, s: string): string {
384
- if (isTurkishCase(c)) {
385
- return mapTurkishCase(s, 'upper')
386
- }
387
- return ToTitle(s)
388
- }
389
-
390
- function isTurkishCase(c: unicode.SpecialCase): boolean {
391
- return c === unicode.TurkishCase || c === unicode.AzeriCase
392
- }
393
-
394
- function mapTurkishCase(s: string, mode: 'upper' | 'lower'): string {
395
- let out = ''
396
- for (const char of s) {
397
- if (mode === 'upper') {
398
- if (char === 'i') {
399
- out += 'İ'
400
- continue
401
- }
402
- if (char === 'ı') {
403
- out += 'I'
404
- continue
405
- }
406
- out += char.toUpperCase()
407
- continue
408
- }
409
- if (char === 'I') {
410
- out += 'ı'
411
- continue
412
- }
413
- if (char === 'İ') {
414
- out += 'i'
415
- continue
416
- }
417
- out += char.toLowerCase()
418
- }
419
- return out
381
+ return Map((r) => c.ToTitle(r), s)
420
382
  }
421
383
 
422
384
  export function ToValidUTF8(s: string, replacement: string): string {
@@ -424,16 +386,30 @@ export function ToValidUTF8(s: string, replacement: string): string {
424
386
  return s
425
387
  }
426
388
 
389
+ // isSeparator reports whether the rune could mark a word boundary.
390
+ function isSeparator(r: number): boolean {
391
+ if (r <= 0x7f) {
392
+ if (r >= 0x30 && r <= 0x39) return false
393
+ if (r >= 0x61 && r <= 0x7a) return false
394
+ if (r >= 0x41 && r <= 0x5a) return false
395
+ if (r === 0x5f) return false
396
+ return true
397
+ }
398
+ if (unicode.IsLetter(r) || unicode.IsDigit(r)) return false
399
+ return unicode.IsSpace(r)
400
+ }
401
+
427
402
  // Title returns a copy of the string s with all Unicode letters that begin words mapped to their Unicode title case.
428
403
  export function Title(s: string): string {
429
- return s
430
- .split(' ')
431
- .map((word) =>
432
- word.length > 0 ?
433
- word[0].toUpperCase() + word.slice(1).toLowerCase()
434
- : word,
435
- )
436
- .join(' ')
404
+ let prev = 0x20
405
+ return Map((r) => {
406
+ if (isSeparator(prev)) {
407
+ prev = r
408
+ return unicode.ToTitle(r)
409
+ }
410
+ prev = r
411
+ return r
412
+ }, s)
437
413
  }
438
414
 
439
415
  // TrimSpace returns a slice of the string s, with all leading and trailing white space removed.
@@ -529,24 +505,35 @@ export function Replace(
529
505
  newStr: string,
530
506
  n: number,
531
507
  ): string {
532
- if (n <= 0 || old === '') {
508
+ if (n === 0 || old === newStr) {
533
509
  return s
534
510
  }
535
511
 
536
- let result = s
537
- let count = 0
538
- let pos = 0
512
+ if (old === '') {
513
+ // Empty old matches at the start and after each rune (code point),
514
+ // yielding up to runeCount+1 insertions; n < 0 means no limit.
515
+ const runes = globalThis.Array.from(s)
516
+ const limit = n < 0 ? runes.length + 1 : Math.min(n, runes.length + 1)
517
+ let result = newStr
518
+ let i = 0
519
+ for (; i < limit - 1; i++) {
520
+ result += runes[i] + newStr
521
+ }
522
+ return result + runes.slice(i).join('')
523
+ }
539
524
 
540
- while (count < n) {
541
- const index = result.indexOf(old, pos)
525
+ // Non-empty old: replace up to n occurrences; n < 0 means all.
526
+ let result = ''
527
+ let start = 0
528
+ let count = 0
529
+ while (n < 0 || count < n) {
530
+ const index = s.indexOf(old, start)
542
531
  if (index === -1) break
543
-
544
- result = result.slice(0, index) + newStr + result.slice(index + old.length)
545
- pos = index + newStr.length
532
+ result += s.slice(start, index) + newStr
533
+ start = index + old.length
546
534
  count++
547
535
  }
548
-
549
- return result
536
+ return result + s.slice(start)
550
537
  }
551
538
 
552
539
  // ReplaceAll returns a copy of the string s with all non-overlapping instances of old replaced by new.
@@ -557,9 +544,35 @@ export function ReplaceAll(s: string, old: string, newStr: string): string {
557
544
  return s.split(old).join(newStr)
558
545
  }
559
546
 
560
- // EqualFold reports whether s and t, interpreted as UTF-8 strings, are equal under Unicode case-folding.
547
+ // EqualFold reports whether s and t, interpreted as UTF-8 strings, are equal under simple Unicode case-folding.
561
548
  export function EqualFold(s: string, t: string): boolean {
562
- return s.toLowerCase() === t.toLowerCase()
549
+ const sr = Array.from(s, (ch) => ch.codePointAt(0)!)
550
+ const tr = Array.from(t, (ch) => ch.codePointAt(0)!)
551
+ let i = 0
552
+ let j = 0
553
+ while (i < sr.length && j < tr.length) {
554
+ let a = sr[i++]
555
+ let b = tr[j++]
556
+ if (a === b) continue
557
+ if (b < a) {
558
+ const tmp = a
559
+ a = b
560
+ b = tmp
561
+ }
562
+ if (b < 0x80) {
563
+ // ASCII: a and b match only as the same letter in opposite case.
564
+ if (a >= 0x41 && a <= 0x5a && b === a + 0x20) continue
565
+ return false
566
+ }
567
+ // Walk the simple-fold orbit of the smaller rune toward the larger.
568
+ let r = unicode.SimpleFold(a)
569
+ while (r !== a && r < b) {
570
+ r = unicode.SimpleFold(r)
571
+ }
572
+ if (r === b) continue
573
+ return false
574
+ }
575
+ return i === sr.length && j === tr.length
563
576
  }
564
577
 
565
578
  // Compare returns an integer comparing two strings lexicographically.
@@ -5,8 +5,8 @@ import * as $ from "@goscript/builtin/index.js";
5
5
  // (particularly if you target 32-bit platforms; see the bugs section).
6
6
  //
7
7
  //go:noescape
8
- export function SwapInt64(addr: $.VarRef<number> | null, _new: number): number {
9
- if (!addr) return 0;
8
+ export function SwapInt64(addr: $.VarRef<bigint> | null, _new: bigint): bigint {
9
+ if (!addr) return 0n;
10
10
  let old = addr.value;
11
11
  addr.value = _new;
12
12
  return old;
@@ -17,8 +17,8 @@ export function SwapInt64(addr: $.VarRef<number> | null, _new: number): number {
17
17
  // (particularly if you target 32-bit platforms; see the bugs section).
18
18
  //
19
19
  //go:noescape
20
- export function SwapUint64(addr: $.VarRef<number> | null, _new: number): number {
21
- if (!addr) return 0;
20
+ export function SwapUint64(addr: $.VarRef<bigint> | null, _new: bigint): bigint {
21
+ if (!addr) return 0n;
22
22
  let old = addr.value;
23
23
  addr.value = _new;
24
24
  return old;
@@ -29,7 +29,7 @@ export function SwapUint64(addr: $.VarRef<number> | null, _new: number): number
29
29
  // (particularly if you target 32-bit platforms; see the bugs section).
30
30
  //
31
31
  //go:noescape
32
- export function CompareAndSwapInt64(addr: $.VarRef<number> | null, old: number, _new: number): boolean {
32
+ export function CompareAndSwapInt64(addr: $.VarRef<bigint> | null, old: bigint, _new: bigint): boolean {
33
33
  if (!addr) return false;
34
34
  if (addr.value === old) {
35
35
  addr.value = _new;
@@ -43,7 +43,7 @@ export function CompareAndSwapInt64(addr: $.VarRef<number> | null, old: number,
43
43
  // (particularly if you target 32-bit platforms; see the bugs section).
44
44
  //
45
45
  //go:noescape
46
- export function CompareAndSwapUint64(addr: $.VarRef<number> | null, old: number, _new: number): boolean {
46
+ export function CompareAndSwapUint64(addr: $.VarRef<bigint> | null, old: bigint, _new: bigint): boolean {
47
47
  if (!addr) return false;
48
48
  if (addr.value === old) {
49
49
  addr.value = _new;
@@ -57,8 +57,8 @@ export function CompareAndSwapUint64(addr: $.VarRef<number> | null, old: number,
57
57
  // (particularly if you target 32-bit platforms; see the bugs section).
58
58
  //
59
59
  //go:noescape
60
- export function AddInt64(addr: $.VarRef<number> | null, delta: number): number {
61
- if (!addr) return 0;
60
+ export function AddInt64(addr: $.VarRef<bigint> | null, delta: bigint): bigint {
61
+ if (!addr) return 0n;
62
62
  addr.value = $.int64Add(addr.value, delta);
63
63
  return addr.value;
64
64
  }
@@ -70,8 +70,8 @@ export function AddInt64(addr: $.VarRef<number> | null, delta: number): number {
70
70
  // (particularly if you target 32-bit platforms; see the bugs section).
71
71
  //
72
72
  //go:noescape
73
- export function AddUint64(addr: $.VarRef<number> | null, delta: number): number {
74
- if (!addr) return 0;
73
+ export function AddUint64(addr: $.VarRef<bigint> | null, delta: bigint): bigint {
74
+ if (!addr) return 0n;
75
75
  addr.value = $.uint64Add(addr.value, delta);
76
76
  return addr.value;
77
77
  }
@@ -81,8 +81,8 @@ export function AddUint64(addr: $.VarRef<number> | null, delta: number): number
81
81
  // Consider using the more ergonomic and less error-prone [Int64.And] instead.
82
82
  //
83
83
  //go:noescape
84
- export function AndInt64(addr: $.VarRef<number> | null, mask: number): number {
85
- if (!addr) return 0;
84
+ export function AndInt64(addr: $.VarRef<bigint> | null, mask: bigint): bigint {
85
+ if (!addr) return 0n;
86
86
  let old = addr.value;
87
87
  addr.value = $.int64And(addr.value, mask);
88
88
  return old;
@@ -93,8 +93,8 @@ export function AndInt64(addr: $.VarRef<number> | null, mask: number): number {
93
93
  // Consider using the more ergonomic and less error-prone [Uint64.And] instead.
94
94
  //
95
95
  //go:noescape
96
- export function AndUint64(addr: $.VarRef<number> | null, mask: number): number {
97
- if (!addr) return 0;
96
+ export function AndUint64(addr: $.VarRef<bigint> | null, mask: bigint): bigint {
97
+ if (!addr) return 0n;
98
98
  let old = addr.value;
99
99
  addr.value = $.uint64And(addr.value, mask);
100
100
  return old;
@@ -105,8 +105,8 @@ export function AndUint64(addr: $.VarRef<number> | null, mask: number): number {
105
105
  // Consider using the more ergonomic and less error-prone [Int64.Or] instead.
106
106
  //
107
107
  //go:noescape
108
- export function OrInt64(addr: $.VarRef<number> | null, mask: number): number {
109
- if (!addr) return 0;
108
+ export function OrInt64(addr: $.VarRef<bigint> | null, mask: bigint): bigint {
109
+ if (!addr) return 0n;
110
110
  let old = addr.value;
111
111
  addr.value = $.int64Or(addr.value, mask);
112
112
  return old;
@@ -117,8 +117,8 @@ export function OrInt64(addr: $.VarRef<number> | null, mask: number): number {
117
117
  // Consider using the more ergonomic and less error-prone [Uint64.Or] instead.
118
118
  //
119
119
  //go:noescape
120
- export function OrUint64(addr: $.VarRef<number> | null, mask: number): number {
121
- if (!addr) return 0;
120
+ export function OrUint64(addr: $.VarRef<bigint> | null, mask: bigint): bigint {
121
+ if (!addr) return 0n;
122
122
  let old = addr.value;
123
123
  addr.value = $.uint64Or(addr.value, mask);
124
124
  return old;
@@ -129,8 +129,8 @@ export function OrUint64(addr: $.VarRef<number> | null, mask: number): number {
129
129
  // (particularly if you target 32-bit platforms; see the bugs section).
130
130
  //
131
131
  //go:noescape
132
- export function LoadInt64(addr: $.VarRef<number> | null): number {
133
- if (!addr) return 0;
132
+ export function LoadInt64(addr: $.VarRef<bigint> | null): bigint {
133
+ if (!addr) return 0n;
134
134
  return addr.value;
135
135
  }
136
136
 
@@ -139,8 +139,8 @@ export function LoadInt64(addr: $.VarRef<number> | null): number {
139
139
  // (particularly if you target 32-bit platforms; see the bugs section).
140
140
  //
141
141
  //go:noescape
142
- export function LoadUint64(addr: $.VarRef<number> | null): number {
143
- if (!addr) return 0;
142
+ export function LoadUint64(addr: $.VarRef<bigint> | null): bigint {
143
+ if (!addr) return 0n;
144
144
  return addr.value;
145
145
  }
146
146
 
@@ -149,7 +149,7 @@ export function LoadUint64(addr: $.VarRef<number> | null): number {
149
149
  // (particularly if you target 32-bit platforms; see the bugs section).
150
150
  //
151
151
  //go:noescape
152
- export function StoreInt64(addr: $.VarRef<number> | null, val: number): void {
152
+ export function StoreInt64(addr: $.VarRef<bigint> | null, val: bigint): void {
153
153
  if (addr) {
154
154
  addr.value = val;
155
155
  }
@@ -160,7 +160,7 @@ export function StoreInt64(addr: $.VarRef<number> | null, val: number): void {
160
160
  // (particularly if you target 32-bit platforms; see the bugs section).
161
161
  //
162
162
  //go:noescape
163
- export function StoreUint64(addr: $.VarRef<number> | null, val: number): void {
163
+ export function StoreUint64(addr: $.VarRef<bigint> | null, val: bigint): void {
164
164
  if (addr) {
165
165
  addr.value = val;
166
166
  }
@@ -11,8 +11,8 @@ describe('sync/atomic 64-bit operations', () => {
11
11
  test('adds uint64 values without mixing number and bigint arithmetic', () => {
12
12
  const value = $.varRef($.uint('18446744073709551614', 64))
13
13
 
14
- expect(AddUint64(value, $.uint(2, 64))).toBe(0)
15
- expect(value.value).toBe(0)
14
+ expect(AddUint64(value, $.uint(2, 64))).toBe(0n)
15
+ expect(value.value).toBe(0n)
16
16
  })
17
17
 
18
18
  test('preserves high uint64 bits for bitwise operations', () => {
@@ -28,9 +28,9 @@ describe('sync/atomic 64-bit operations', () => {
28
28
  })
29
29
 
30
30
  test('adds int64 values without number coercion', () => {
31
- const value = $.varRef($.int('9223372036854775807', 64))
31
+ const value = $.varRef($.int64('9223372036854775807'))
32
32
 
33
- expect(AddInt64(value, 1)).toBe(-9223372036854775808)
34
- expect(value.value).toBe(-9223372036854775808)
33
+ expect(AddInt64(value, 1n)).toBe(-9223372036854775808n)
34
+ expect(value.value).toBe(-9223372036854775808n)
35
35
  })
36
36
  })
@@ -223,20 +223,20 @@ export class Int32 {
223
223
  }
224
224
 
225
225
  export class Int64 {
226
- public get v(): number {
226
+ public get v(): bigint {
227
227
  return this._fields.v.value
228
228
  }
229
- public set v(value: number) {
229
+ public set v(value: bigint) {
230
230
  this._fields.v.value = value
231
231
  }
232
232
 
233
233
  public _fields: {
234
- v: $.VarRef<number>;
234
+ v: $.VarRef<bigint>;
235
235
  }
236
236
 
237
- constructor(init?: Partial<{v?: number}>) {
237
+ constructor(init?: Partial<{v?: bigint}>) {
238
238
  this._fields = {
239
- v: $.varRef(init?.v ?? 0)
239
+ v: $.varRef(init?.v ?? 0n)
240
240
  }
241
241
  }
242
242
 
@@ -249,45 +249,45 @@ export class Int64 {
249
249
  }
250
250
 
251
251
  // Load atomically loads and returns the value stored in x.
252
- public Load(): number {
252
+ public Load(): bigint {
253
253
  const x = this
254
254
  return LoadInt64(x._fields.v)
255
255
  }
256
256
 
257
257
  // Store atomically stores val into x.
258
- public Store(val: number): void {
258
+ public Store(val: bigint): void {
259
259
  const x = this
260
260
  StoreInt64(x._fields.v, val)
261
261
  }
262
262
 
263
263
  // Swap atomically stores new into x and returns the previous value.
264
- public Swap(_new: number): number {
264
+ public Swap(_new: bigint): bigint {
265
265
  const x = this
266
266
  return SwapInt64(x._fields.v, _new)
267
267
  }
268
268
 
269
269
  // CompareAndSwap executes the compare-and-swap operation for x.
270
- public CompareAndSwap(old: number, _new: number): boolean {
270
+ public CompareAndSwap(old: bigint, _new: bigint): boolean {
271
271
  const x = this
272
272
  return CompareAndSwapInt64(x._fields.v, old, _new)
273
273
  }
274
274
 
275
275
  // Add atomically adds delta to x and returns the new value.
276
- public Add(delta: number): number {
276
+ public Add(delta: bigint): bigint {
277
277
  const x = this
278
278
  return AddInt64(x._fields.v, delta)
279
279
  }
280
280
 
281
281
  // And atomically performs a bitwise AND operation on x using the bitmask
282
282
  // provided as mask and returns the old value.
283
- public And(mask: number): number {
283
+ public And(mask: bigint): bigint {
284
284
  const x = this
285
285
  return AndInt64(x._fields.v, mask)
286
286
  }
287
287
 
288
288
  // Or atomically performs a bitwise OR operation on x using the bitmask
289
289
  // provided as mask and returns the old value.
290
- public Or(mask: number): number {
290
+ public Or(mask: bigint): bigint {
291
291
  const x = this
292
292
  return OrInt64(x._fields.v, mask)
293
293
  }
@@ -296,9 +296,9 @@ export class Int64 {
296
296
  static __typeInfo = $.registerStructType(
297
297
  'Int64',
298
298
  new Int64(),
299
- [{ name: "Load", args: [], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "Store", args: [{ name: "val", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [] }, { name: "Swap", args: [{ name: "new", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "CompareAndSwap", args: [{ name: "old", type: { kind: $.TypeKind.Basic, name: "number" } }, { name: "new", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "boolean" } }] }, { name: "Add", args: [{ name: "delta", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "And", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "Or", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }],
299
+ [{ name: "Load", args: [], returns: [{ type: { kind: $.TypeKind.Basic, name: "int64" } }] }, { name: "Store", args: [{ name: "val", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [] }, { name: "Swap", args: [{ name: "new", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "int64" } }] }, { name: "CompareAndSwap", args: [{ name: "old", type: { kind: $.TypeKind.Basic, name: "int64" } }, { name: "new", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "boolean" } }] }, { name: "Add", args: [{ name: "delta", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "int64" } }] }, { name: "And", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "int64" } }] }, { name: "Or", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "int64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "int64" } }] }],
300
300
  Int64,
301
- [{ name: "v", key: "v", type: { kind: $.TypeKind.Basic, name: "number" } }]
301
+ [{ name: "v", key: "v", type: { kind: $.TypeKind.Basic, name: "int64" } }]
302
302
  );
303
303
  }
304
304
 
@@ -383,20 +383,20 @@ export class Uint32 {
383
383
  }
384
384
 
385
385
  export class Uint64 {
386
- public get v(): number {
386
+ public get v(): bigint {
387
387
  return this._fields.v.value
388
388
  }
389
- public set v(value: number) {
389
+ public set v(value: bigint) {
390
390
  this._fields.v.value = value
391
391
  }
392
392
 
393
393
  public _fields: {
394
- v: $.VarRef<number>;
394
+ v: $.VarRef<bigint>;
395
395
  }
396
396
 
397
- constructor(init?: Partial<{v?: number}>) {
397
+ constructor(init?: Partial<{v?: bigint}>) {
398
398
  this._fields = {
399
- v: $.varRef(init?.v ?? 0)
399
+ v: $.varRef(init?.v ?? 0n)
400
400
  }
401
401
  }
402
402
 
@@ -409,45 +409,45 @@ export class Uint64 {
409
409
  }
410
410
 
411
411
  // Load atomically loads and returns the value stored in x.
412
- public Load(): number {
412
+ public Load(): bigint {
413
413
  const x = this
414
414
  return LoadUint64(x._fields.v)
415
415
  }
416
416
 
417
417
  // Store atomically stores val into x.
418
- public Store(val: number): void {
418
+ public Store(val: bigint): void {
419
419
  const x = this
420
420
  StoreUint64(x._fields.v, val)
421
421
  }
422
422
 
423
423
  // Swap atomically stores new into x and returns the previous value.
424
- public Swap(_new: number): number {
424
+ public Swap(_new: bigint): bigint {
425
425
  const x = this
426
426
  return SwapUint64(x._fields.v, _new)
427
427
  }
428
428
 
429
429
  // CompareAndSwap executes the compare-and-swap operation for x.
430
- public CompareAndSwap(old: number, _new: number): boolean {
430
+ public CompareAndSwap(old: bigint, _new: bigint): boolean {
431
431
  const x = this
432
432
  return CompareAndSwapUint64(x._fields.v, old, _new)
433
433
  }
434
434
 
435
435
  // Add atomically adds delta to x and returns the new value.
436
- public Add(delta: number): number {
436
+ public Add(delta: bigint): bigint {
437
437
  const x = this
438
438
  return AddUint64(x._fields.v, delta)
439
439
  }
440
440
 
441
441
  // And atomically performs a bitwise AND operation on x using the bitmask
442
442
  // provided as mask and returns the old value.
443
- public And(mask: number): number {
443
+ public And(mask: bigint): bigint {
444
444
  const x = this
445
445
  return AndUint64(x._fields.v, mask)
446
446
  }
447
447
 
448
448
  // Or atomically performs a bitwise OR operation on x using the bitmask
449
449
  // provided as mask and returns the old value.
450
- public Or(mask: number): number {
450
+ public Or(mask: bigint): bigint {
451
451
  const x = this
452
452
  return OrUint64(x._fields.v, mask)
453
453
  }
@@ -456,9 +456,9 @@ export class Uint64 {
456
456
  static __typeInfo = $.registerStructType(
457
457
  'Uint64',
458
458
  new Uint64(),
459
- [{ name: "Load", args: [], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "Store", args: [{ name: "val", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [] }, { name: "Swap", args: [{ name: "new", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "CompareAndSwap", args: [{ name: "old", type: { kind: $.TypeKind.Basic, name: "number" } }, { name: "new", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "boolean" } }] }, { name: "Add", args: [{ name: "delta", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "And", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }, { name: "Or", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "number" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "number" } }] }],
459
+ [{ name: "Load", args: [], returns: [{ type: { kind: $.TypeKind.Basic, name: "uint64" } }] }, { name: "Store", args: [{ name: "val", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [] }, { name: "Swap", args: [{ name: "new", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "uint64" } }] }, { name: "CompareAndSwap", args: [{ name: "old", type: { kind: $.TypeKind.Basic, name: "uint64" } }, { name: "new", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "boolean" } }] }, { name: "Add", args: [{ name: "delta", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "uint64" } }] }, { name: "And", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "uint64" } }] }, { name: "Or", args: [{ name: "mask", type: { kind: $.TypeKind.Basic, name: "uint64" } }], returns: [{ type: { kind: $.TypeKind.Basic, name: "uint64" } }] }],
460
460
  Uint64,
461
- [{ name: "v", key: "v", type: { kind: $.TypeKind.Basic, name: "number" } }]
461
+ [{ name: "v", key: "v", type: { kind: $.TypeKind.Basic, name: "uint64" } }]
462
462
  );
463
463
  }
464
464