Merge pull request #3649 from yglukhov/nil-seq-copy
Fixed copying of nil seq in JS
This commit is contained in:
commit
39f78ae4f1
1 changed files with 12 additions and 7 deletions
|
|
@ -533,15 +533,20 @@ proc nimCopy(dest, src: JSRef, ti: PNimType): JSRef =
|
||||||
nimCopyAux(result, src, ti.node)
|
nimCopyAux(result, src, ti.node)
|
||||||
of tySequence, tyArrayConstr, tyOpenArray, tyArray:
|
of tySequence, tyArrayConstr, tyOpenArray, tyArray:
|
||||||
asm """
|
asm """
|
||||||
if (`dest` === null || `dest` === undefined) {
|
if (`src` === null) {
|
||||||
`dest` = new Array(`src`.length);
|
`result` = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
`dest`.length = `src`.length;
|
if (`dest` === null || `dest` === undefined) {
|
||||||
}
|
`dest` = new Array(`src`.length);
|
||||||
`result` = `dest`;
|
}
|
||||||
for (var i = 0; i < `src`.length; ++i) {
|
else {
|
||||||
`result`[i] = nimCopy(`result`[i], `src`[i], `ti`.base);
|
`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:
|
of tyString:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue