first version of an PHP codegen
This commit is contained in:
parent
58f6bfb1dc
commit
35567a1eb9
8 changed files with 665 additions and 411 deletions
|
|
@ -2452,14 +2452,17 @@ type
|
|||
|
||||
when defined(JS):
|
||||
proc add*(x: var string, y: cstring) {.asmNoStackFrame.} =
|
||||
asm """
|
||||
var len = `x`[0].length-1;
|
||||
for (var i = 0; i < `y`.length; ++i) {
|
||||
`x`[0][len] = `y`.charCodeAt(i);
|
||||
++len;
|
||||
}
|
||||
`x`[0][len] = 0
|
||||
"""
|
||||
when defined(nimphp):
|
||||
asm """`x` .= `y`;"""
|
||||
else:
|
||||
asm """
|
||||
var len = `x`[0].length-1;
|
||||
for (var i = 0; i < `y`.length; ++i) {
|
||||
`x`[0][len] = `y`.charCodeAt(i);
|
||||
++len;
|
||||
}
|
||||
`x`[0][len] = 0
|
||||
"""
|
||||
proc add*(x: var cstring, y: cstring) {.magic: "AppendStrStr".}
|
||||
|
||||
elif hasAlloc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue