mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 18:39:09 +02:00
Codetool: FindDeclaration, fix "generic array" in fdt_generics_finddeclaration.pas / Fix issue #39738
This commit is contained in:
parent
a8b58da637
commit
f47e51faf4
@ -4724,6 +4724,15 @@ var
|
|||||||
or StartContextNode.HasAsParent(ContextNode) then
|
or StartContextNode.HasAsParent(ContextNode) then
|
||||||
// searching an ancestor => don't search within ancestors
|
// searching an ancestor => don't search within ancestors
|
||||||
Exclude(Flags,fdfSearchInAncestors);
|
Exclude(Flags,fdfSearchInAncestors);
|
||||||
|
end else if ContextNode.Desc=ctnGenericParams then begin
|
||||||
|
if SearchInGenericParams(ContextNode) then begin
|
||||||
|
FindIdentifierInContext:=true;
|
||||||
|
{$IFDEF ShowCollect}
|
||||||
|
if fdfCollect in Flags then
|
||||||
|
raise Exception.Create('fdfCollect must never return true');
|
||||||
|
{$ENDIF}
|
||||||
|
exit(AbortNoCacheResult);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (ContextNode=StartContextNode)
|
if (ContextNode=StartContextNode)
|
||||||
@ -13201,38 +13210,28 @@ begin
|
|||||||
if (ArrayNode=nil) then exit;
|
if (ArrayNode=nil) then exit;
|
||||||
if (ArrayNode.Desc<>ctnOpenArrayType) and (ArrayNode.Desc<>ctnRangedArrayType)
|
if (ArrayNode.Desc<>ctnOpenArrayType) and (ArrayNode.Desc<>ctnRangedArrayType)
|
||||||
then exit;
|
then exit;
|
||||||
if (ArrayNode.Parent <> nil)
|
MoveCursorToNodeStart(ArrayNode);
|
||||||
and (ArrayNode.Parent.Desc = ctnGenericType)
|
ReadNextAtom; // array
|
||||||
and (ParentParams <> nil) then begin
|
if not UpAtomIs('ARRAY') then exit;
|
||||||
// TODO: make sure there is ONLY ONE GenParam
|
ReadNextAtom; // of
|
||||||
ExprType.Desc := xtContext;
|
if CurPos.Flag=cafEdgedBracketOpen then begin
|
||||||
ExprType.Context.Node := ParentParams.GenParams.SpecializeParamsNode.FirstChild;
|
ReadTilBracketClose(true);
|
||||||
ExprType.Context.Tool := ParentParams.GenParams.ParamValuesTool;
|
|
||||||
Result:=true;
|
|
||||||
end else begin
|
|
||||||
MoveCursorToNodeStart(ArrayNode);
|
|
||||||
ReadNextAtom; // array
|
|
||||||
if not UpAtomIs('ARRAY') then exit;
|
|
||||||
ReadNextAtom; // of
|
|
||||||
if CurPos.Flag=cafEdgedBracketOpen then begin
|
|
||||||
ReadTilBracketClose(true);
|
|
||||||
ReadNextAtom;
|
|
||||||
end;
|
|
||||||
if not UpAtomIs('OF') then exit;
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if not AtomIsIdentifier then exit;
|
end;
|
||||||
Params:=TFindDeclarationParams.Create;
|
if not UpAtomIs('OF') then exit;
|
||||||
Params.GenParams := ParentParams.GenParams;
|
ReadNextAtom;
|
||||||
try
|
if not AtomIsIdentifier then exit;
|
||||||
Params.Flags:=fdfDefaultForExpressions;
|
Params:=TFindDeclarationParams.Create;
|
||||||
Params.ContextNode:=ArrayNode;
|
Params.GenParams := ParentParams.GenParams;
|
||||||
p:=CurPos.StartPos;
|
try
|
||||||
Params.SetIdentifier(Self,@Src[p],nil);
|
Params.Flags:=fdfDefaultForExpressions;
|
||||||
ExprType:=FindExpressionResultType(Params,p,-1,AliasType);
|
Params.ContextNode:=ArrayNode;
|
||||||
Result:=true;
|
p:=CurPos.StartPos;
|
||||||
finally
|
Params.SetIdentifier(Self,@Src[p],nil);
|
||||||
Params.Free;
|
ExprType:=FindExpressionResultType(Params,p,-1,AliasType);
|
||||||
end;
|
Result:=true;
|
||||||
|
finally
|
||||||
|
Params.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user