From 81d66a49641f15ac98615365ee328ada90625381 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 2 Jun 2013 17:38:54 +0000 Subject: [PATCH] codetools: identifier completion: fixed checking for overloaded procs git-svn-id: trunk@41498 - --- components/codetools/identcompletiontool.pas | 12 +++++++++--- components/codetools/pascalreadertool.pas | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 8024b0308e..cd255b1217 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -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; diff --git a/components/codetools/pascalreadertool.pas b/components/codetools/pascalreadertool.pas index bdca589e6f..883677ebab 100644 --- a/components/codetools/pascalreadertool.pas +++ b/components/codetools/pascalreadertool.pas @@ -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);