fcl-passrc: resolving (a as b)[]

git-svn-id: trunk@45964 -
This commit is contained in:
Mattias Gaertner 2020-07-29 21:53:13 +00:00
parent fc5a1d81c7
commit 0fa8ef9fa9
2 changed files with 17 additions and 10 deletions

View File

@ -11025,14 +11025,15 @@ begin
ResolveBinaryExpr(TBinaryExpr(Params.Value),Access);
if not (Value.CustomData is TResolvedReference) then
RaiseNotYetImplemented(20190115144534,Params);
// already resolved
// already resolved via ResolveNameExpr, which calls ResolveArrayParamsExprName
exit;
end
else
begin
// ToDo: (a+b)[]
//ResolveBinaryExpr(TBinaryExpr(Params.Value),rraRead);
RaiseNotYetImplemented(20190115144539,Params);
// For example (a+b)[] or (a as b)[]
Value:=Params.Value;
ResolveBinaryExpr(TBinaryExpr(Value),rraRead);
ComputeElement(Value,ResolvedEl,[rcSetReferenceFlags]);
end;
end
else

View File

@ -13146,23 +13146,29 @@ begin
Add([
'type',
' TObject = class',
' end;',
' TBird = class',
' function GetB(Index: longint): longint;',
' procedure SetB(Index: longint; Value: longint);',
' property B[Index: longint]: longint read GetB write SetB; default;',
' end;',
'function TObject.GetB(Index: longint): longint;',
'function TBird.GetB(Index: longint): longint;',
'begin',
'end;',
'procedure TObject.SetB(Index: longint; Value: longint);',
'procedure TBird.SetB(Index: longint; Value: longint);',
'begin',
' if Value=Self[Index] then ;',
' Self[Index]:=Value;',
'end;',
'var o: TObject;',
'var',
' b: TBird;',
' o: TObject;',
'begin',
' o[3]:=4;',
' if o[5]=6 then;',
' if 7=o[8] then;']);
' b[3]:=4;',
' if b[5]=6 then;',
' if 7=b[8] then;',
' (o as TBird)[9]:=10;',
'']);
ParseProgram;
end;