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

View File

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