codetools: identifier completion: fixed checking for overloaded procs

git-svn-id: trunk@41498 -
This commit is contained in:
mattias 2013-06-02 17:38:54 +00:00
parent efec9f2a26
commit 81d66a4964
2 changed files with 17 additions and 3 deletions

View File

@ -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;

View File

@ -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);