diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-08-19 02:33:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 11:33:52 +0200 |
commit | 394f4ac7bb92fe5aaf902495c6b43b3451667602 (patch) | |
tree | 8957f2337957a2c28d152490d07be106b1dd2994 /lib/system.nim | |
parent | 7b58dc2de0f606b757a558dfdda9d930ae63f41a (diff) | |
download | Nim-394f4ac7bb92fe5aaf902495c6b43b3451667602.tar.gz |
improvements to `addInt` and `$` for integer types (#18592)
* improvements to $(SomeInteger) and addInt * remove mIntToStr, mInt64ToStr * improvements * fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode * rm tests/system/tstrmantle.nim * revert compiler/jsgen.nim for -d:nimVersion140
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim index e6a2439df..740c4419f 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2463,14 +2463,13 @@ when notJSnotNims: else: {.error: "Only closure iterator is allowed!".} +from std/private/digitsutils import addInt +export addInt + when defined(js): include "system/jssys" include "system/reprjs" -when defined(js) or defined(nimscript): - proc addInt*(result: var string; x: int64) = - result.add $x - proc quit*(errormsg: string, errorcode = QuitFailure) {.noreturn.} = ## A shorthand for `echo(errormsg); quit(errorcode)`. when defined(nimscript) or defined(js) or (hostOS == "standalone"): @@ -2918,7 +2917,7 @@ proc addQuoted*[T](s: var string, x: T) = s.addEscapedChar(x) s.add("'") # prevent temporary string allocation - elif T is SomeSignedInt: + elif T is SomeInteger: s.addInt(x) elif T is SomeFloat: s.addFloat(x) |