diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2021-11-02 16:30:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 16:30:59 +0100 |
commit | 9d51197aa4eb404c3cce8c5989146dea8d3de024 (patch) | |
tree | 5209b123ab7ddba4b5032f048ef746b51c379a91 /lib/std/private | |
parent | a55b90827ed87b61972147e8120c9afa949d17f9 (diff) | |
download | Nim-9d51197aa4eb404c3cce8c5989146dea8d3de024.tar.gz |
fixes #19078 [backport] (#19090)
Diffstat (limited to 'lib/std/private')
-rw-r--r-- | lib/std/private/digitsutils.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/std/private/digitsutils.nim b/lib/std/private/digitsutils.nim index 9be2ab3ef..588bcaec0 100644 --- a/lib/std/private/digitsutils.nim +++ b/lib/std/private/digitsutils.nim @@ -78,14 +78,17 @@ func addIntImpl(result: var string, x: uint64) {.inline.} = dec next addChars(result, tmp, next, tmp.len - next) -func addInt*(result: var string, x: uint64) = +when not defined(nimHasEnforceNoRaises): + {.pragma: enforceNoRaises.} + +func addInt*(result: var string, x: uint64) {.enforceNoRaises.} = when nimvm: addIntImpl(result, x) else: when not defined(js): addIntImpl(result, x) else: addChars(result, numToString(x)) -proc addInt*(result: var string; x: int64) = +proc addInt*(result: var string; x: int64) {.enforceNoRaises.} = ## Converts integer to its string representation and appends it to `result`. runnableExamples: var s = "foo" @@ -110,5 +113,5 @@ proc addInt*(result: var string; x: int64) = addChars(result, numToString(x)) else: impl() -proc addInt*(result: var string; x: int) {.inline.} = +proc addInt*(result: var string; x: int) {.inline, enforceNoRaises.} = addInt(result, int64(x)) |