mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 16:00:30 +02:00
codetools: fixed TIdentifierList.FindIdentifier searching identifier that is not a proc
git-svn-id: trunk@41261 -
This commit is contained in:
parent
4491daff55
commit
62f6dfef9d
@ -716,20 +716,37 @@ end;
|
|||||||
function TIdentifierList.FindIdentifier(Identifier: PChar): TIdentifierListItem;
|
function TIdentifierList.FindIdentifier(Identifier: PChar): TIdentifierListItem;
|
||||||
var
|
var
|
||||||
AVLNode: TAVLTreeNode;
|
AVLNode: TAVLTreeNode;
|
||||||
|
StartNode: TAVLTreeNode;
|
||||||
begin
|
begin
|
||||||
|
Result:=nil;
|
||||||
FIdentSearchItem.Identifier:=Identifier;
|
FIdentSearchItem.Identifier:=Identifier;
|
||||||
// ignore ParamList (for checking function overloading)
|
// ignore ParamList (for checking function overloading)
|
||||||
AVLNode:=FIdentView.FindLeftMostKey(FIdentSearchItem,
|
StartNode:=FIdentView.FindKey(FIdentSearchItem,@CompareIdentListSearchWithItemsWithoutParams);
|
||||||
@CompareIdentListSearchWithItemsWithoutParams);
|
if StartNode=nil then exit;
|
||||||
while (AVLNode<>nil)
|
if not (TIdentifierListItem(StartNode.Data).GetDesc in [ctnProcedure,ctnProcedureHead])
|
||||||
and not (TIdentifierListItem(AVLNode.Data).GetDesc in [ctnProcedure,ctnProcedureHead])
|
then
|
||||||
and (CompareIdentifiers(Identifier,PChar(TIdentifierListItem(AVLNode.Data).Identifier))=0)
|
exit(TIdentifierListItem(StartNode.Data));
|
||||||
do
|
// identifier is a proc, find the same identifier that is not a proc
|
||||||
|
AVLNode:=StartNode;
|
||||||
|
repeat
|
||||||
AVLNode:=FIdentView.FindSuccessor(AVLNode);
|
AVLNode:=FIdentView.FindSuccessor(AVLNode);
|
||||||
if AVLNode<>nil then
|
if (AVLNode=nil)
|
||||||
Result:=TIdentifierListItem(AVLNode.Data)
|
or (CompareIdentifiers(Identifier,PChar(TIdentifierListItem(AVLNode.Data).Identifier))<>0)
|
||||||
else
|
then break;
|
||||||
Result:=nil;
|
if not (TIdentifierListItem(AVLNode.Data).GetDesc in [ctnProcedure,ctnProcedureHead])
|
||||||
|
then
|
||||||
|
exit(TIdentifierListItem(AVLNode.Data));
|
||||||
|
until false;
|
||||||
|
AVLNode:=StartNode;
|
||||||
|
repeat
|
||||||
|
AVLNode:=FIdentView.FindPrecessor(AVLNode);
|
||||||
|
if (AVLNode=nil)
|
||||||
|
or (CompareIdentifiers(Identifier,PChar(TIdentifierListItem(AVLNode.Data).Identifier))<>0)
|
||||||
|
then break;
|
||||||
|
if not (TIdentifierListItem(AVLNode.Data).GetDesc in [ctnProcedure,ctnProcedureHead])
|
||||||
|
then
|
||||||
|
exit(TIdentifierListItem(AVLNode.Data));
|
||||||
|
until false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIdentifierList.FindCreatedIdentifier(const Ident: string): integer;
|
function TIdentifierList.FindCreatedIdentifier(const Ident: string): integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user