mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
Merge pull request #3649 from yglukhov/nil-seq-copy
Fixed copying of nil seq in JS
This commit is contained in:
@@ -533,15 +533,20 @@ proc nimCopy(dest, src: JSRef, ti: PNimType): JSRef =
|
||||
nimCopyAux(result, src, ti.node)
|
||||
of tySequence, tyArrayConstr, tyOpenArray, tyArray:
|
||||
asm """
|
||||
if (`dest` === null || `dest` === undefined) {
|
||||
`dest` = new Array(`src`.length);
|
||||
if (`src` === null) {
|
||||
`result` = null;
|
||||
}
|
||||
else {
|
||||
`dest`.length = `src`.length;
|
||||
}
|
||||
`result` = `dest`;
|
||||
for (var i = 0; i < `src`.length; ++i) {
|
||||
`result`[i] = nimCopy(`result`[i], `src`[i], `ti`.base);
|
||||
if (`dest` === null || `dest` === undefined) {
|
||||
`dest` = new Array(`src`.length);
|
||||
}
|
||||
else {
|
||||
`dest`.length = `src`.length;
|
||||
}
|
||||
`result` = `dest`;
|
||||
for (var i = 0; i < `src`.length; ++i) {
|
||||
`result`[i] = nimCopy(`result`[i], `src`[i], `ti`.base);
|
||||
}
|
||||
}
|
||||
"""
|
||||
of tyString:
|
||||
|
||||
Reference in New Issue
Block a user