Codetools: prevent endless loop in FindExpressionTypeOfTerm

This commit is contained in:
Martin 2022-05-09 22:36:58 +02:00
parent 01a6b1dd5f
commit caa6e333a2

View File

@ -9798,6 +9798,11 @@ var
end; end;
procedure ResolvePoint; procedure ResolvePoint;
var
CurDesc: TExpressionTypeDesc;
CurTool: TFindDeclarationTool;
CurNodeDesc: TCodeTreeNodeDesc;
CurNodeStart: Integer;
begin begin
// for example 'A.B' // for example 'A.B'
if fdfExtractOperand in Params.Flags then if fdfExtractOperand in Params.Flags then
@ -9808,7 +9813,22 @@ var
ReadNextAtom; ReadNextAtom;
RaiseIdentExpected(20191003163224); RaiseIdentExpected(20191003163224);
end; end;
CurDesc := ExprType.Desc;
CurTool := ExprType.Context.Tool;
CurNodeDesc := ExprType.Context.Node.Desc;
CurNodeStart := ExprType.Context.Node.StartPos-1;
repeat repeat
if (CurDesc = ExprType.Desc) and
(CurTool = ExprType.Context.Tool) and
(CurNodeDesc = ExprType.Context.Node.Desc) and
(CurNodeStart = ExprType.Context.Node.StartPos)
then
break;
CurDesc := ExprType.Desc;
CurTool := ExprType.Context.Tool;
CurNodeDesc := ExprType.Context.Node.Desc;
CurNodeStart := ExprType.Context.Node.StartPos;
ResolveChildren; ResolveChildren;
if ExprType.Desc in xtAllTypeHelperTypes then begin if ExprType.Desc in xtAllTypeHelperTypes then begin
// Lazarus supports record helpers for basic types (string) as well (with TYPEHELPERS modeswitch!). // Lazarus supports record helpers for basic types (string) as well (with TYPEHELPERS modeswitch!).