From a2c989e1b4a0edfc594ac3d05c95505bb2fe4a09 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 17 May 2009 02:16:55 +0000 Subject: [PATCH] codetools: started searching published methods in ancestor classes git-svn-id: trunk@20000 - --- components/codetools/codecompletiontool.pas | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index d2f7751804..4e8cfbcbd9 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -263,6 +263,8 @@ type out AllRemoved: boolean; const Attr: TProcHeadAttributes; out RemovedProcHeads: TStrings): boolean; + function GatherPublishedMethods(ClassNode: TCodeTreeNode; + out ListOfPFindContext: TFPList): boolean; // custom class completion function InitClassCompletion(const UpperClassName: string; @@ -4120,9 +4122,20 @@ var s: TPascalClassSection; procedure GatherClassProcs; + var + PublishedMethods: TFPList; begin // gather existing proc definitions in the class if ClassProcs=nil then begin + PublishedMethods:=nil; + try + {$IFDEF EnableInheritedEmptyMethods} + DebugLn(['GatherClassProcs AAA1']); + GatherPublishedMethods(FCompletingStartNode,PublishedMethods); + {$ENDIF} + finally + FreeListOfPFindContext(PublishedMethods); + end; ClassProcs:=GatherProcNodes(FCompletingStartNode, [phpInUpperCase,phpAddClassName], ExtractClassName(FCodeCompleteClassNode,true)); @@ -4326,6 +4339,28 @@ begin end; end; +function TCodeCompletionCodeTool.GatherPublishedMethods( + ClassNode: TCodeTreeNode; out ListOfPFindContext: TFPList): boolean; +var + Ancestors: TFPList; // list of PFindContext + i: Integer; + Context: PFindContext; +begin + Result:=false; + Ancestors:=nil; + ListOfPFindContext:=nil; + try + if not FindClassAndAncestors(ClassNode,Ancestors) then exit; + if Ancestors=nil then exit(true); + for i:=0 to Ancestors.Count-1 do begin + Context:=PFindContext(Ancestors[i]); + DebugLn(['TCodeCompletionCodeTool.GatherPublishedMethods ',Context^.Node.DescAsString]); + end; + finally + FreeListOfPFindContext(Ancestors); + end; +end; + function TCodeCompletionCodeTool.InitClassCompletion( const UpperClassName: string; SourceChangeCache: TSourceChangeCache): boolean;