mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-07 13:00:39 +01:00
pastojs: fixed insert(item,arr,pos)
git-svn-id: trunk@37491 -
This commit is contained in:
parent
c2f870b60d
commit
aa83ab3c7d
@ -7378,7 +7378,7 @@ end;
|
||||
function TPasToJSConverter.ConvertBuiltIn_InsertArray(El: TParamsExpr;
|
||||
AContext: TConvertContext): TJSElement;
|
||||
// procedure insert(item,var array,const position)
|
||||
// -> array.splice(position,1,item);
|
||||
// -> array.splice(position,0,item);
|
||||
var
|
||||
ArrEl: TJSElement;
|
||||
Call: TJSCallExpression;
|
||||
@ -7390,7 +7390,7 @@ begin
|
||||
ArrEl:=ConvertElement(El.Params[1],AContext);
|
||||
Call.Expr:=CreateDotExpression(El,ArrEl,CreatePrimitiveDotExpr('splice',El));
|
||||
Call.AddArg(ConvertElement(El.Params[2],AContext));
|
||||
Call.AddArg(CreateLiteralNumber(El,1));
|
||||
Call.AddArg(CreateLiteralNumber(El,0));
|
||||
Call.AddArg(ConvertElement(El.Params[0],AContext));
|
||||
Result:=Call;
|
||||
finally
|
||||
|
||||
@ -5867,12 +5867,12 @@ begin
|
||||
'this.ArrJSValue = [];',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'$mod.ArrInt.splice(2, 1, 1);',
|
||||
'$mod.ArrInt.splice(4, 1, $mod.ArrInt[3]);',
|
||||
'$mod.ArrRec.splice(6, 1, $mod.ArrRec[5]);',
|
||||
'$mod.ArrSet.splice(7, 1, $mod.ArrSet[7]);',
|
||||
'$mod.ArrJSValue.splice(9, 1, $mod.ArrJSValue[8]);',
|
||||
'$mod.ArrJSValue.splice(11, 1, 10);',
|
||||
'$mod.ArrInt.splice(2, 0, 1);',
|
||||
'$mod.ArrInt.splice(4, 0, $mod.ArrInt[3]);',
|
||||
'$mod.ArrRec.splice(6, 0, $mod.ArrRec[5]);',
|
||||
'$mod.ArrSet.splice(7, 0, $mod.ArrSet[7]);',
|
||||
'$mod.ArrJSValue.splice(9, 0, $mod.ArrJSValue[8]);',
|
||||
'$mod.ArrJSValue.splice(11, 0, 10);',
|
||||
'$mod.ArrInt.splice(12, 13);',
|
||||
'$mod.ArrRec.splice(14, 15);',
|
||||
'$mod.ArrSet.splice(17, 18);',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user