mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:39:37 +02:00
codetools: identifier completion collecting forward class definitions, bug #13101
git-svn-id: trunk@18542 -
This commit is contained in:
parent
90e58cc971
commit
feaa627c17
@ -189,6 +189,7 @@ type
|
||||
function Count: integer;
|
||||
function GetFilteredCount: integer;
|
||||
function HasIdentifier(Identifier: PChar; const ParamList: string): boolean;
|
||||
function FindIdentifier(Identifier: PChar; const ParamList: string): TIdentifierListItem;
|
||||
function FindCreatedIdentifier(const Ident: string): integer;
|
||||
function CreateIdentifier(const Ident: string): PChar;
|
||||
function StartUpAtomInFrontIs(const s: string): boolean;
|
||||
@ -654,11 +655,25 @@ function TIdentifierList.HasIdentifier(Identifier: PChar;
|
||||
const ParamList: string): boolean;
|
||||
begin
|
||||
FIdentSearchItem.Identifier:=Identifier;
|
||||
FIdentSearchItem.ParamList:='';
|
||||
FIdentSearchItem.ParamList:=ParamList;
|
||||
Result:=FIdentView.FindKey(FIdentSearchItem,
|
||||
@CompareIdentListSearchWithItems)<>nil;
|
||||
end;
|
||||
|
||||
function TIdentifierList.FindIdentifier(Identifier: PChar;
|
||||
const ParamList: string): TIdentifierListItem;
|
||||
var
|
||||
AVLNode: TAVLTreeNode;
|
||||
begin
|
||||
FIdentSearchItem.Identifier:=Identifier;
|
||||
FIdentSearchItem.ParamList:=ParamList;
|
||||
AVLNode:=FIdentView.FindKey(FIdentSearchItem,@CompareIdentListSearchWithItems);
|
||||
if AVLNode<>nil then
|
||||
Result:=TIdentifierListItem(AVLNode.Data)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIdentifierList.FindCreatedIdentifier(const Ident: string): integer;
|
||||
begin
|
||||
if Ident<>'' then begin
|
||||
@ -871,19 +886,23 @@ begin
|
||||
|
||||
ctnTypeDefinition,ctnGenericType:
|
||||
begin
|
||||
Node:=FoundContext.Tool.FindTypeNodeOfDefinition(FoundContext.Node);
|
||||
if (Node<>nil)
|
||||
and (Node.Desc in [ctnClass,ctnClassInterface])
|
||||
and ((ctnsForwardDeclaration and Node.SubDesc)>0)
|
||||
then
|
||||
// skip forward definition
|
||||
exit;
|
||||
Node:=FoundContext.Node.FirstChild;
|
||||
if FoundContext.Node.Desc=ctnTypeDefinition then
|
||||
Ident:=@FoundContext.Tool.Src[FoundContext.Node.StartPos]
|
||||
else begin
|
||||
// generic
|
||||
if FoundContext.Node.FirstChild=nil then exit;
|
||||
Ident:=@FoundContext.Tool.Src[FoundContext.Node.FirstChild.StartPos];
|
||||
if Node=nil then exit;
|
||||
Ident:=@FoundContext.Tool.Src[Node.StartPos];
|
||||
end;
|
||||
if (Node<>nil)
|
||||
and (Node.Desc in [ctnClass,ctnClassInterface])
|
||||
and ((ctnsForwardDeclaration and Node.SubDesc)>0)
|
||||
then begin
|
||||
// forward definition of a class
|
||||
if CurrentIdentifierList.FindIdentifier(Ident,'')<>nil then begin
|
||||
// the real class is already in the list => skip forward
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user