pastojs: fixed error on Arr+=

git-svn-id: trunk@47244 -
This commit is contained in:
Mattias Gaertner 2020-10-28 20:34:36 +00:00
parent b51c89df41
commit 2ab0b76f3c
2 changed files with 12 additions and 5 deletions

View File

@ -21516,6 +21516,8 @@ begin
else
RaiseNotSupported(El,AContext,20180415101516);
end;
if (LeftTypeEl.ClassType=TPasArrayType) and (El.Kind<>akDefault) then
aResolver.RaiseMsg(20201028212754,nIllegalQualifier,sIllegalQualifier,[AssignKindNames[El.Kind]],El);
end;
end;
if AssignContext.RightSide=nil then
@ -21589,12 +21591,16 @@ begin
begin
// right side is dynamic array
if (AssignContext.LeftResolved.BaseType=btContext)
and (AssignContext.LeftResolved.LoTypeEl is TPasArrayType)
and (not RightIsTemporaryVar)
and (not LeftIsConstSetter) then
and (AssignContext.LeftResolved.LoTypeEl is TPasArrayType) then
begin
// DynArrayA := DynArrayB -> DynArrayA = rtl.arrayRef(DynArrayB)
AssignContext.RightSide:=CreateArrayRef(El.right,AssignContext.RightSide);
if El.Kind<>akDefault then
aResolver.RaiseMsg(20201028213335,nIllegalQualifier,sIllegalQualifier,[AssignKindNames[El.Kind]],El);
if (not RightIsTemporaryVar)
and (not LeftIsConstSetter) then
begin
// DynArrayA := DynArrayB -> DynArrayA = rtl.arrayRef(DynArrayB)
AssignContext.RightSide:=CreateArrayRef(El.right,AssignContext.RightSide);
end;
end;
end;
end

View File

@ -10176,6 +10176,7 @@ end;
procedure TTestModule.TestArray_DynArrayConstObjFPC;
begin
Parser.Options:=Parser.Options+[po_cassignments];
StartProgram(false);
Add([
'{$modeswitch arrayoperators}',