diff options
Diffstat (limited to 'lib/system/dollars.nim')
-rw-r--r-- | lib/system/dollars.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/system/dollars.nim b/lib/system/dollars.nim index 08f230c6a..836d5764c 100644 --- a/lib/system/dollars.nim +++ b/lib/system/dollars.nim @@ -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. |