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

View File

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