From dce69caec1ee243da2ff23487156a157fa424fbb Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 11 Jun 2012 19:03:56 +0000 Subject: [PATCH] codetools: class completion: fixed searching var node when first is class var git-svn-id: trunk@37625 - --- components/codetools/codecompletiontool.pas | 28 +++++++-------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 1f51de503d..73522cf7f2 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -513,17 +513,13 @@ begin // search in new nodes, which will be inserted ANodeExt:=FirstInsert; while ANodeExt<>nil do begin - if CompareTextIgnoringSpace(ANodeExt.Txt,UpperName,true)=0 then begin - Result:=true; - exit; - end; + if CompareTextIgnoringSpace(ANodeExt.Txt,UpperName,true)=0 then + exit(true); ANodeExt:=ANodeExt.Next; end; - if not Result then begin - // ToDo: check ancestor vars too - // search in current class - Result:=(FindVarNode(FCompletingStartNode,UpperName)<>nil); - end; + // ToDo: check ancestor vars too + // search in current class + Result:=(FindVarNode(FCompletingStartNode,UpperName)<>nil); end; procedure TCodeCompletionCodeTool.AddClassInsertion( @@ -6864,17 +6860,11 @@ const Identifiers = AllIdentifierDefinitions+[ctnProperty,ctnProcedure,ctnClassGUID]; begin if ClassNode=nil then exit(nil); - Result:=CodeCompleteClassNode.FirstChild; + Result:=ClassNode.FirstChild; while Result<>nil do begin - if (Result.Desc in Identifiers) then begin - break; - end else if (Result.Desc in AllClassSections) - and (Result.FirstChild<>nil) - and (Result.FirstChild.Desc in Identifiers) then begin - Result:=Result.FirstChild; - break; - end else - Result:=Result.NextBrother; + if (Result.Desc in Identifiers) then + exit; + Result:=FindNextIdentNodeInClass(Result); end; end;