diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 9 | ||||
-rw-r--r-- | lib/system/dollars.nim | 17 |
2 files changed, 22 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim index 3ba2050b6..541c691eb 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2049,10 +2049,6 @@ template unlikely*(val: bool): bool = else: unlikelyProc(val) - -import system/dollars -export dollars - const NimMajor* {.intdefine.}: int = 1 ## is the major number of Nim's version. Example: @@ -2063,10 +2059,15 @@ const NimMinor* {.intdefine.}: int = 3 ## is the minor number of Nim's version. + ## Odd for devel, even for releases. NimPatch* {.intdefine.}: int = 1 ## is the patch number of Nim's version. +import system/dollars +export dollars + +const NimVersion*: string = $NimMajor & "." & $NimMinor & "." & $NimPatch ## is the version of Nim as a string. 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. |