mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 00:19:19 +02:00
pastojs: fixed arraySetLength shrink
git-svn-id: trunk@46272 -
This commit is contained in:
parent
ec10ee8218
commit
68a3e33cac
11
utils/pas2js/dist/rtl.js
vendored
11
utils/pas2js/dist/rtl.js
vendored
@ -916,18 +916,23 @@ var rtl = {
|
||||
srclen = 0;
|
||||
oldlen = a.length;
|
||||
}
|
||||
a.length = stack[depth].dim;
|
||||
lastlen = stack[depth].dim;
|
||||
a.length = lastlen;
|
||||
if (depth>0){
|
||||
item.a[item.i]=a;
|
||||
item.i++;
|
||||
if ((lastlen===0) && (item.i<item.a.length)) continue;
|
||||
}
|
||||
if (lastlen>0){
|
||||
if (depth<dimmax){
|
||||
item = stack[depth];
|
||||
item.a = a;
|
||||
item.i = 0;
|
||||
item.src = src;
|
||||
depth++;
|
||||
continue;
|
||||
} else {
|
||||
if (srclen>lastlen) srclen=lastlen;
|
||||
if (rtl.isArray(defaultvalue)){
|
||||
// array of dyn array
|
||||
for (var i=0; i<srclen; i++) a[i]=src[i];
|
||||
@ -946,6 +951,9 @@ var rtl = {
|
||||
for (var i=0; i<srclen; i++) a[i]=src[i];
|
||||
for (var i=oldlen; i<lastlen; i++) a[i]=defaultvalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// backtrack
|
||||
while ((depth>0) && (stack[depth-1].i>=stack[depth-1].dim)){
|
||||
depth--;
|
||||
};
|
||||
@ -953,7 +961,6 @@ var rtl = {
|
||||
if (dimmax===0) return a;
|
||||
return stack[0].a;
|
||||
}
|
||||
}
|
||||
}while (true);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user