From 5ed99f8d3fc67d6f02172ab9cbcc67c17eeee5c9 Mon Sep 17 00:00:00 2001 From: Arne Döring Date: Mon, 28 Oct 2019 10:06:16 +0100 Subject: Extent json.to testing to VM, add workrounds for VM bugs. (#12493) fixes #12479 --- lib/system.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/system.nim') diff --git a/lib/system.nim b/lib/system.nim index 93e4534fb..663ac1f66 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -3872,6 +3872,12 @@ elif defined(JS): proc deallocShared(p: pointer) = discard proc reallocShared(p: pointer, newsize: Natural): pointer = discard + proc addInt*(result: var string; x: int64) = + result.add $x + + proc addFloat*(result: var string; x: float) = + result.add $x + when defined(JS) and not defined(nimscript): include "system/jssys" include "system/reprjs" @@ -4326,9 +4332,9 @@ proc addQuoted*[T](s: var string, x: T) = s.addEscapedChar(x) s.add("'") # prevent temporary string allocation - elif T is SomeSignedInt and not defined(JS): + elif T is SomeSignedInt: s.addInt(x) - elif T is SomeFloat and not defined(JS): + elif T is SomeFloat: s.addFloat(x) elif compiles(s.add(x)): s.add(x) -- cgit 1.4.1-2-gfad0