mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 11:49:55 +02:00
codetools: fixed FindUnitInUsesSection
git-svn-id: trunk@20302 -
This commit is contained in:
parent
e776d10bc7
commit
124bcb7012
@ -1749,13 +1749,17 @@ begin
|
||||
NamePos:=CleanAtomPosition;
|
||||
InPos:=CleanAtomPosition;
|
||||
if (UsesNode=nil) or (AnUnitName='') or (length(AnUnitName)>255)
|
||||
or (UsesNode.Desc<>ctnUsesSection) then exit;
|
||||
or (UsesNode.Desc<>ctnUsesSection) then begin
|
||||
DebugLn(['TFindDeclarationTool.FindUnitInUsesSection invalid AnUnitName']);
|
||||
exit;
|
||||
end;
|
||||
MoveCursorToNodeStart(UsesNode);
|
||||
ReadNextAtom; // read 'uses'
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if AtomIsChar(';') then break;
|
||||
if AtomIs(AnUnitName) then begin
|
||||
if (CurPos.StartPos>SrcLen) then break;
|
||||
if CompareSrcIdentifiers(CurPos.StartPos,@AnUnitName[1]) then begin
|
||||
NamePos:=CurPos;
|
||||
InPos.StartPos:=-1;
|
||||
ReadNextAtom;
|
||||
@ -1773,7 +1777,7 @@ begin
|
||||
end;
|
||||
if AtomIsChar(';') then break;
|
||||
if not AtomIsChar(',') then break;
|
||||
until (CurPos.StartPos>SrcLen);;
|
||||
until (CurPos.StartPos>SrcLen);
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.FindUnitInAllUsesSections(
|
||||
@ -1783,7 +1787,10 @@ begin
|
||||
Result:=false;
|
||||
NamePos.StartPos:=-1;
|
||||
InPos.StartPos:=-1;
|
||||
if (AnUnitName='') or (length(AnUnitName)>255) then exit;
|
||||
if (AnUnitName='') or (length(AnUnitName)>255) then begin
|
||||
DebugLn(['TFindDeclarationTool.FindUnitInAllUsesSections invalid AnUnitName']);
|
||||
exit;
|
||||
end;
|
||||
BuildTree(false);
|
||||
SectionNode:=Tree.Root;
|
||||
while (SectionNode<>nil) and (SectionNode.Desc in [ctnProgram, ctnUnit,
|
||||
|
@ -403,7 +403,6 @@ begin
|
||||
|
||||
// update {$I filename} directive
|
||||
Filename := ExtractFileName(lrsFileName);
|
||||
DebugLn(['TProjectResources.UpdateMainSourceFile AAA1 ',CodeBuf.Filename]);
|
||||
if CodeToolBoss.FindIncludeDirective(CodeBuf, 1, 1,
|
||||
NewCode, NewX, NewY,
|
||||
NewTopLine, Filename, false) then
|
||||
|
Loading…
Reference in New Issue
Block a user