codetools: TLinkScanner.FindCodeInRange: return only links with code

git-svn-id: trunk@38539 -
This commit is contained in:
mattias 2012-09-06 14:59:46 +00:00
parent b9c2d8fc91
commit da2404fdb3
2 changed files with 7 additions and 4 deletions

View File

@ -4064,6 +4064,7 @@ procedure TLinkScanner.FindCodeInRange(CleanStartPos, CleanEndPos: integer;
UniqueSortedCodeList: TFPList);
var ACode: Pointer;
LinkIndex: integer;
Link: PSourceLink;
begin
if (CleanStartPos<1) or (CleanStartPos>CleanEndPos)
or (CleanEndPos>CleanedLen+1) or (UniqueSortedCodeList=nil) then exit;
@ -4073,10 +4074,13 @@ begin
AddCodeToUniqueList(ACode,UniqueSortedCodeList);
repeat
inc(LinkIndex);
if (LinkIndex>=LinkCount) or (FLinks[LinkIndex].CleanedPos>CleanEndPos) then
if (LinkIndex>=LinkCount) then
exit;
if ACode<>FLinks[LinkIndex].Code then begin
ACode:=FLinks[LinkIndex].Code;
Link:=@FLinks[LinkIndex];
if (Link^.CleanedPos>CleanEndPos) then
exit;
if (ACode<>Link^.Code) and (Link^.Code<>nil) then begin
ACode:=Link^.Code;
AddCodeToUniqueList(ACode,UniqueSortedCodeList);
end;
until false;

View File

@ -3133,7 +3133,6 @@ function TStandardCodeTool.ReplaceWords(IdentList: TStrings;
CurSource: string;
i: integer;
begin
CurSource:=ACode.Source;
MaxPos:=length(CurSource);
StartPos:=1;
// go through all source parts between compiler directives