mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 10:18:17 +02:00
codetools: identifier completion: fixed checking for overloaded procs
git-svn-id: trunk@41498 -
This commit is contained in:
parent
efec9f2a26
commit
81d66a4964
@ -1134,9 +1134,15 @@ begin
|
||||
Ident:=FoundContext.Tool.GetProcNameIdentifier(FoundContext.Node);
|
||||
NewItem := CurrentIdentifierList.FindIdentifier(Ident);
|
||||
if (NewItem<>nil) and (NewItem.Tool<>nil) then begin
|
||||
if (Lvl > NewItem.Level + 1)
|
||||
or ((Lvl <> NewItem.Level) and not NewItem.Tool.ProcNodeHasSpecifier(NewItem.Node, psOVERLOAD))
|
||||
then Ident := nil; // there is a previous declaration without 'overload'
|
||||
if (Lvl > NewItem.Level + 1) then
|
||||
Ident := nil // there is a previous declaration which can not be overloaded
|
||||
else if (Lvl <> NewItem.Level) then begin
|
||||
// there is a previous declaration on same level
|
||||
if (NewItem.Node.Desc<>ctnProcedure)
|
||||
or (not NewItem.Tool.ProcNodeHasSpecifier(NewItem.Node, psOVERLOAD))
|
||||
then
|
||||
Ident := nil; // there is a previous declaration without 'overload'
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1260,6 +1260,14 @@ function TPascalReaderTool.ProcNodeHasSpecifier(ProcNode: TCodeTreeNode;
|
||||
begin
|
||||
Result:=false;
|
||||
if ProcNode=nil then exit;
|
||||
{$IFDEF CheckNodeTool}
|
||||
if ProcNode.Desc<>ctnProcedure then begin
|
||||
DebugLn(['TPascalReaderTool.ProcNodeHasSpecifier Desc=',ProcNode.DescAsString]);
|
||||
CTDumpStack;
|
||||
RaiseException('[TPascalReaderTool.ProcNodeHasSpecifier] '
|
||||
+'internal error: invalid ProcNode');
|
||||
end;
|
||||
{$ENDIF}
|
||||
if (ProcNode.FirstChild=nil)
|
||||
or ((ProcNode.SubDesc and ctnsNeedJITParsing)>0) then
|
||||
BuildSubTreeForProcHead(ProcNode);
|
||||
|
Loading…
Reference in New Issue
Block a user