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

git-svn-id: trunk@37625 -
This commit is contained in:
mattias 2012-06-11 19:03:56 +00:00
parent c0eaae3966
commit dce69caec1

View File

@ -513,18 +513,14 @@ begin
// search in new nodes, which will be inserted // search in new nodes, which will be inserted
ANodeExt:=FirstInsert; ANodeExt:=FirstInsert;
while ANodeExt<>nil do begin while ANodeExt<>nil do begin
if CompareTextIgnoringSpace(ANodeExt.Txt,UpperName,true)=0 then begin if CompareTextIgnoringSpace(ANodeExt.Txt,UpperName,true)=0 then
Result:=true; exit(true);
exit;
end;
ANodeExt:=ANodeExt.Next; ANodeExt:=ANodeExt.Next;
end; end;
if not Result then begin
// ToDo: check ancestor vars too // ToDo: check ancestor vars too
// search in current class // search in current class
Result:=(FindVarNode(FCompletingStartNode,UpperName)<>nil); Result:=(FindVarNode(FCompletingStartNode,UpperName)<>nil);
end; end;
end;
procedure TCodeCompletionCodeTool.AddClassInsertion( procedure TCodeCompletionCodeTool.AddClassInsertion(
const CleanDef, Def, IdentifierName: string; TheType: TNewClassPart; const CleanDef, Def, IdentifierName: string; TheType: TNewClassPart;
@ -6864,17 +6860,11 @@ const
Identifiers = AllIdentifierDefinitions+[ctnProperty,ctnProcedure,ctnClassGUID]; Identifiers = AllIdentifierDefinitions+[ctnProperty,ctnProcedure,ctnClassGUID];
begin begin
if ClassNode=nil then exit(nil); if ClassNode=nil then exit(nil);
Result:=CodeCompleteClassNode.FirstChild; Result:=ClassNode.FirstChild;
while Result<>nil do begin while Result<>nil do begin
if (Result.Desc in Identifiers) then begin if (Result.Desc in Identifiers) then
break; exit;
end else if (Result.Desc in AllClassSections) Result:=FindNextIdentNodeInClass(Result);
and (Result.FirstChild<>nil)
and (Result.FirstChild.Desc in Identifiers) then begin
Result:=Result.FirstChild;
break;
end else
Result:=Result.NextBrother;
end; end;
end; end;