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