codetools: keywordfunclists: use fast property Count

git-svn-id: branches/fixes_1_8@54641 -
This commit is contained in:
mattias 2017-04-19 11:02:29 +00:00
parent 1e655bcb16
commit 27937b0e13

View File

@ -85,7 +85,7 @@ type
procedure WriteDebugListing; procedure WriteDebugListing;
function AllwaysTrue: boolean; function AllwaysTrue: boolean;
function AllwaysFalse: boolean; function AllwaysFalse: boolean;
function Count: integer; property Count: integer read FCount;
function GetItem(Index: integer): TBaseKeyWordFunctionListItem; function GetItem(Index: integer): TBaseKeyWordFunctionListItem;
function IndexOf(const AKeyWord: shortstring): integer; function IndexOf(const AKeyWord: shortstring): integer;
function CalcMemSize: PtrUInt; function CalcMemSize: PtrUInt;
@ -504,11 +504,6 @@ begin
Result:=false; Result:=false;
end; end;
function TBaseKeyWordFunctionList.Count: integer;
begin
Result:=FCount;
end;
function TBaseKeyWordFunctionList.GetItem(Index: integer function TBaseKeyWordFunctionList.GetItem(Index: integer
): TBaseKeyWordFunctionListItem; ): TBaseKeyWordFunctionListItem;
begin begin
@ -517,6 +512,8 @@ end;
function TBaseKeyWordFunctionList.IndexOf(const AKeyWord: shortstring): integer; function TBaseKeyWordFunctionList.IndexOf(const AKeyWord: shortstring): integer;
begin begin
if not Sorted then Sort;
Result:=FCount-1; Result:=FCount-1;
while (Result>=0) and (CompareText(FItems[Result].KeyWord,AKeyWord)<>0) do while (Result>=0) and (CompareText(FItems[Result].KeyWord,AKeyWord)<>0) do
dec(Result); dec(Result);