codetools: class completion: fixed gathr proc definitions

git-svn-id: trunk@36889 -
This commit is contained in:
mattias 2012-04-17 21:37:06 +00:00
parent e0fcfe75fe
commit 4693905f72
2 changed files with 24 additions and 7 deletions

View File

@ -7847,7 +7847,7 @@ var
ANodeExt: TCodeTreeNodeExtension;
ANode: TCodeTreeNode;
begin
Result:=GatherProcNodes(GetFirstClassIdentifier(ClassNode),
Result:=GatherProcNodes(ClassNode.FirstChild,
[phpInUpperCase,phpAddClassName],ExtractClassName(ClassNode,true));
if RemoveAbstracts then begin
AnAVLNode:=Result.FindLowest;
@ -8140,6 +8140,9 @@ begin
{$ENDIF}
if CodeCompleteClassNode.Desc in AllClassInterfaces then begin
// interfaces have no implementations
{$IFDEF CTDEBUG}
debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies interface ',CodeCompleteClassNode.DescAsString]);
{$ENDIF}
exit(true);
end;
@ -8149,7 +8152,9 @@ begin
ClassProcs:=nil;
ProcBodyNodes:=nil;
try
//debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies get class procs of ',CodeCompleteClassNode.DescAsString]);
ClassProcs:=GatherClassProcDefinitions(CodeCompleteClassNode,true);
//debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies get bodies of ',CodeCompleteClassNode.DescAsString]);
ProcBodyNodes:=GatherClassProcBodies(CodeCompleteClassNode);
{AnAVLNode:=ClassProcs.FindLowest;

View File

@ -786,21 +786,29 @@ var CurProcName: string;
NewNodeExt: TCodeTreeNodeExtension;
cmp: boolean;
CurClassName: String;
LastNode: TCodeTreeNode;
begin
//debugln(['TMethodJumpingCodeTool.GatherProcNodes START']);
Result:=TAVLTree.Create(@CompareCodeTreeNodeExt);
if (StartNode=nil) or (StartNode.Parent=nil) then exit;
ANode:=StartNode;
while (ANode<>nil) do begin
LastNode:=ANode.Parent;
while LastNode.Desc in AllClassSections do
LastNode:=LastNode.Parent;
LastNode:=LastNode.NextSkipChilds;
while (ANode<>LastNode) do begin
//debugln(['TMethodJumpingCodeTool.GatherProcNodes ',ANode.DescAsString]);
if ANode.Desc=ctnProcedure then begin
if (not ((phpIgnoreForwards in Attr)
and ((ANode.SubDesc and ctnsForwardDeclaration)>0)))
and (not ((phpIgnoreProcsWithBody in Attr)
and (FindProcBody(ANode)<>nil))) then
begin
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] B');
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] Proc found');
cmp:=true;
if (phpOnlyWithClassname in Attr) then begin
CurClassName:=ExtractClassNameOfProcNode(ANode,true);
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] B2 "',CurClassName,'" =? ',FilterClassName);
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] Proc Class="',CurClassName,'" =? ',FilterClassName,'=Filter');
if CompareText(FilterClassName,CurClassName)<>0 then
cmp:=false;
@ -813,9 +821,9 @@ begin
cmp:=false;
end;
if cmp then begin
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] C');
//DebugLn('[TMethodJumpingCodeTool.GatherProcNodes] Proc with right class');
CurProcName:=ExtractProcHead(ANode,Attr);
//DebugLn(['[TMethodJumpingCodeTool.GatherProcNodes] D "',CurProcName,'" ',phpInUpperCase in Attr]);
//DebugLn(['[TMethodJumpingCodeTool.GatherProcNodes] Proc with right class, name="',CurProcName,'" phpInUpperCase=',phpInUpperCase in Attr]);
if (CurProcName<>'') then begin
NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin
@ -828,8 +836,12 @@ begin
end;
end;
// next node
ANode:=FindNextNodeOnSameLvl(ANode);
if ANode.Desc in AllClassSections then
ANode:=ANode.Next
else
ANode:=ANode.NextSkipChilds;
end;
//debugln(['TMethodJumpingCodeTool.GatherProcNodes END']);
end;
function TMethodJumpingCodeTool.FindFirstDifferenceNode(