$ now works for unsigned intergers with nim js (#14122)
* $(unsigned) now works for js * move NimMajor+friends closer to NimVersion according as per reviewer feedback
This commit is contained in:
parent
0e6eb96a5f
commit
a3a317b76d
4 changed files with 96 additions and 4 deletions
|
|
@ -1,8 +1,25 @@
|
|||
include system/inclrtl
|
||||
|
||||
proc `$`*(x: int): string {.magic: "IntToStr", noSideEffect.}
|
||||
## The stringify operator for an integer argument. Returns `x`
|
||||
## converted to a decimal string. ``$`` is Nim's general way of
|
||||
## spelling `toString`:idx:.
|
||||
|
||||
when defined(js):
|
||||
since (1, 3):
|
||||
proc `$`*(x: uint): string =
|
||||
## Caveat: currently implemented as $(cast[int](x)), tied to current
|
||||
## semantics of js' Number type.
|
||||
# for c, see strmantle.`$`
|
||||
$(cast[int](x))
|
||||
|
||||
proc `$`*(x: uint64): string =
|
||||
## Compatibility note:
|
||||
## the results may change in future releases if/when js target implements
|
||||
## 64bit ints.
|
||||
# pending https://github.com/nim-lang/RFCs/issues/187
|
||||
$(cast[int](x))
|
||||
|
||||
proc `$`*(x: int64): string {.magic: "Int64ToStr", noSideEffect.}
|
||||
## The stringify operator for an integer argument. Returns `x`
|
||||
## converted to a decimal string.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue