Extent json.to testing to VM, add workrounds for VM bugs. (#12493)

fixes #12479
This commit is contained in:
Arne Döring 2019-10-28 10:06:16 +01:00 • committed by Andreas Rumpf
commit 5ed99f8d3f
3 changed files with 261 additions and 172 deletions

View file

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