codetools: class completion: fixed searching var node when first is class var

git-svn-id: trunk@37626 -
This commit is contained in:
mattias 2012-06-11 19:16:11 +00:00
parent dce69caec1
commit 2b6a6b48bd
2 changed files with 18 additions and 11 deletions

View File

@ -418,17 +418,13 @@ begin
// search in new nodes, which will be inserted
ANodeExt:=FirstInsert;
while ANodeExt<>nil do begin
if CompareTextIgnoringSpace(ANodeExt.Txt,NameAndParamsUpCase,true)=0 then begin
Result:=true;
exit;
end;
if CompareTextIgnoringSpace(ANodeExt.Txt,NameAndParamsUpCase,true)=0 then
exit(true);
ANodeExt:=ANodeExt.Next;
end;
if not Result then begin
// ToDo: check ancestor procs too
// search in current class
Result:=(FindProcNode(FCompletingStartNode,NameAndParamsUpCase,[phpInUpperCase])<>nil);
end;
// ToDo: check ancestor procs too
// search in current class
Result:=(FindProcNode(FCompletingStartNode,NameAndParamsUpCase,[phpInUpperCase])<>nil);
end;
procedure TCodeCompletionCodeTool.SetCodeCompleteClassNode(const AClassNode: TCodeTreeNode);

View File

@ -727,8 +727,10 @@ function TPascalReaderTool.FindProcNode(StartNode: TCodeTreeNode;
// (e.g. 'public', 'private', ...) then the search will continue in the next
// section
var CurProcHead: string;
InClass: Boolean;
begin
Result:=StartNode;
InClass:=FindClassOrInterfaceNode(StartNode)<>nil;
while (Result<>nil) do begin
//DebugLn('TPascalReaderTool.FindProcNode A "',NodeDescriptionAsString(Result.Desc),'"');
if Result.Desc=ctnProcedure then begin
@ -745,7 +747,10 @@ begin
end;
end;
// next node
Result:=FindNextNodeOnSameLvl(Result);
if InClass then
Result:=FindNextIdentNodeInClass(Result)
else
Result:=FindNextNodeOnSameLvl(Result);
end;
end;
@ -1608,13 +1613,19 @@ end;
function TPascalReaderTool.FindVarNode(StartNode: TCodeTreeNode;
const UpperVarName: string): TCodeTreeNode;
var
InClass: Boolean;
begin
Result:=StartNode;
InClass:=FindClassOrInterfaceNode(StartNode)<>nil;
while Result<>nil do begin
if (Result.Desc=ctnVarDefinition)
and (CompareNodeIdentChars(Result,UpperVarName)=0) then
exit;
Result:=FindNextIdentNodeInClass(Result);
if InClass then
Result:=FindNextIdentNodeInClass(Result)
else
Result:=FindNextNodeOnSameLvl(Result);
end;
end;