mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 13:09:43 +02:00
pastojs: fixed concat(a) calling arrayRef
git-svn-id: trunk@46745 -
(cherry picked from commit 6a0ea119e9
)
This commit is contained in:
parent
6b9509cbb9
commit
ec44fd2dd6
@ -13334,7 +13334,7 @@ begin
|
||||
{$IFDEF VerbosePas2JS}
|
||||
writeln('TPasToJSConverter.ConvertBuiltInConcatArray Count=',length(El.Params));
|
||||
{$ENDIF}
|
||||
Result:=ConvertExpression(Param0,AContext);
|
||||
Result:=CreateArrayRef(El,ConvertExpression(Param0,AContext));
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -17619,6 +17619,8 @@ function TPasToJSConverter.CreateArrayRef(El: TPasElement; ArrayExpr: TJSElement
|
||||
var
|
||||
Call: TJSCallExpression;
|
||||
begin
|
||||
if ArrayExpr is TJSArrayLiteral then
|
||||
exit(ArrayExpr);
|
||||
Call:=CreateCallExpression(El);
|
||||
Call.Expr:=CreateMemberExpression([GetBIName(pbivnRTL),GetBIName(pbifnArray_Reference)]);
|
||||
Call.AddArg(ArrayExpr);
|
||||
|
@ -9878,16 +9878,16 @@ begin
|
||||
'this.ArrJSValue = [];',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'$mod.ArrInt = $mod.ArrInt;',
|
||||
'$mod.ArrInt = rtl.arrayRef($mod.ArrInt);',
|
||||
'$mod.ArrInt = rtl.arrayConcatN($mod.ArrInt, $mod.ArrInt);',
|
||||
'$mod.ArrInt = rtl.arrayConcatN($mod.ArrInt, $mod.ArrInt, $mod.ArrInt);',
|
||||
'$mod.ArrRec = $mod.ArrRec;',
|
||||
'$mod.ArrRec = rtl.arrayRef($mod.ArrRec);',
|
||||
'$mod.ArrRec = rtl.arrayConcat($mod.TRec, $mod.ArrRec, $mod.ArrRec);',
|
||||
'$mod.ArrRec = rtl.arrayConcat($mod.TRec, $mod.ArrRec, $mod.ArrRec, $mod.ArrRec);',
|
||||
'$mod.ArrSet = $mod.ArrSet;',
|
||||
'$mod.ArrSet = rtl.arrayRef($mod.ArrSet);',
|
||||
'$mod.ArrSet = rtl.arrayConcat("refSet", $mod.ArrSet, $mod.ArrSet);',
|
||||
'$mod.ArrSet = rtl.arrayConcat("refSet", $mod.ArrSet, $mod.ArrSet, $mod.ArrSet);',
|
||||
'$mod.ArrJSValue = $mod.ArrJSValue;',
|
||||
'$mod.ArrJSValue = rtl.arrayRef($mod.ArrJSValue);',
|
||||
'$mod.ArrJSValue = rtl.arrayConcatN($mod.ArrJSValue, $mod.ArrJSValue);',
|
||||
'$mod.ArrJSValue = rtl.arrayConcatN($mod.ArrJSValue, $mod.ArrJSValue, $mod.ArrJSValue);',
|
||||
'$mod.ArrInt = rtl.arrayConcatN([1], $mod.ArrInt);',
|
||||
|
2
utils/pas2js/dist/rtl.js
vendored
2
utils/pas2js/dist/rtl.js
vendored
@ -1004,7 +1004,7 @@ var rtl = {
|
||||
var src = arguments[i];
|
||||
if (src === null) continue;
|
||||
if (a===null){
|
||||
a=src; // Note: concat(a) does not clone
|
||||
a=rtl.arrayRef(src); // Note: concat(a) does not clone
|
||||
} else {
|
||||
a=a.concat(src);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user