Automatic deref for everything but pointers in asm/emit (#8891)

Fixes #7249
This commit is contained in:
LemonBoy 2018-09-07 01:54:59 +02:00 • committed by Andreas Rumpf
commit af1e84f54d
5 changed files with 42 additions and 10 deletions

View file

@ -2741,12 +2741,12 @@ type
when defined(JS):
proc add*(x: var string, y: cstring) {.asmNoStackFrame.} =
asm """
var len = `x`[0].length-1;
var len = `x`.length-1;
for (var i = 0; i < `y`.length; ++i) {
`x`[0][len] = `y`.charCodeAt(i);
`x`[len] = `y`.charCodeAt(i);
++len;
}
`x`[0][len] = 0
`x`[len] = 0
"""
proc add*(x: var cstring, y: cstring) {.magic: "AppendStrStr".}