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
This commit is contained in:
Timothee Cour 2021-08-19 02:33:52 -07:00 • committed by GitHub
commit 394f4ac7bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 162 additions and 186 deletions

View file

@ -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)