mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 03:17:22 +01:00
codetools: TStandardCodeTool.FindMissingUnits: dotted names
git-svn-id: trunk@32118 -
This commit is contained in:
parent
5190b83a71
commit
8bdf7647bb
@ -80,7 +80,7 @@ const
|
|||||||
ctnVarDefinition = 21;
|
ctnVarDefinition = 21;
|
||||||
ctnConstDefinition = 22;
|
ctnConstDefinition = 22;
|
||||||
ctnGlobalProperty = 23;
|
ctnGlobalProperty = 23;
|
||||||
ctnUseUnit = 24;
|
ctnUseUnit = 24; // StartPos=unitname, EndPos=unitname+inFilename
|
||||||
ctnVarArgs = 25;
|
ctnVarArgs = 25;
|
||||||
|
|
||||||
ctnClass = 30;
|
ctnClass = 30;
|
||||||
|
|||||||
@ -1864,8 +1864,8 @@ begin
|
|||||||
AtomIsIdentifier(true);
|
AtomIsIdentifier(true);
|
||||||
CreateChildNode;
|
CreateChildNode;
|
||||||
CurNode.Desc:=ctnUseUnit;
|
CurNode.Desc:=ctnUseUnit;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
|
||||||
repeat
|
repeat
|
||||||
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if CurPos.Flag<>cafPoint then break;
|
if CurPos.Flag<>cafPoint then break;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
|||||||
@ -129,7 +129,7 @@ type
|
|||||||
function UsesSectionToUnitnames(UsesNode: TCodeTreeNode): TStrings;
|
function UsesSectionToUnitnames(UsesNode: TCodeTreeNode): TStrings;
|
||||||
function FindMissingUnits(var MissingUnits: TStrings; FixCase: boolean;
|
function FindMissingUnits(var MissingUnits: TStrings; FixCase: boolean;
|
||||||
SearchImplementation: boolean;
|
SearchImplementation: boolean;
|
||||||
SourceChangeCache: TSourceChangeCache): boolean; // ToDo: dotted
|
SourceChangeCache: TSourceChangeCache): boolean;
|
||||||
function CommentUnitsInUsesSections(MissingUnits: TStrings;
|
function CommentUnitsInUsesSections(MissingUnits: TStrings;
|
||||||
SourceChangeCache: TSourceChangeCache): boolean; // ToDo: dotted
|
SourceChangeCache: TSourceChangeCache): boolean; // ToDo: dotted
|
||||||
function FindUnusedUnits(Units: TStrings): boolean; // ToDo: dotted
|
function FindUnusedUnits(Units: TStrings): boolean; // ToDo: dotted
|
||||||
@ -1444,7 +1444,6 @@ function TStandardCodeTool.FindMissingUnits(var MissingUnits: TStrings;
|
|||||||
|
|
||||||
function CheckUsesSection(UsesNode: TCodeTreeNode): boolean;
|
function CheckUsesSection(UsesNode: TCodeTreeNode): boolean;
|
||||||
var
|
var
|
||||||
InAtom, UnitNameAtom: TAtomPosition;
|
|
||||||
OldUnitName: String;
|
OldUnitName: String;
|
||||||
OldInFilename: String;
|
OldInFilename: String;
|
||||||
AFilename: String;
|
AFilename: String;
|
||||||
@ -1453,20 +1452,15 @@ function TStandardCodeTool.FindMissingUnits(var MissingUnits: TStrings;
|
|||||||
NewInFilename: String;
|
NewInFilename: String;
|
||||||
FromPos: LongInt;
|
FromPos: LongInt;
|
||||||
ToPos: LongInt;
|
ToPos: LongInt;
|
||||||
|
Node: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
if UsesNode=nil then exit(true);
|
if UsesNode=nil then exit(true);
|
||||||
if not CheckDirectoryCache then exit(false);
|
if not CheckDirectoryCache then exit(false);
|
||||||
|
|
||||||
MoveCursorToUsesStart(UsesNode);
|
Node:=UsesNode.FirstChild;
|
||||||
repeat
|
while Node<>nil do begin
|
||||||
// read next unit name
|
// read next unit name
|
||||||
ReadNextUsedUnit(UnitNameAtom, InAtom);
|
OldUnitName:=ExtractUsedUnitName(Node,@OldInFilename);
|
||||||
OldUnitName:=GetAtom(UnitNameAtom);
|
|
||||||
if InAtom.StartPos>0 then
|
|
||||||
OldInFilename:=copy(Src,InAtom.StartPos+1,
|
|
||||||
InAtom.EndPos-InAtom.StartPos-2)
|
|
||||||
else
|
|
||||||
OldInFilename:='';
|
|
||||||
// find unit file
|
// find unit file
|
||||||
NewUnitName:=OldUnitName;
|
NewUnitName:=OldUnitName;
|
||||||
NewInFilename:=OldInFilename;
|
NewInFilename:=OldInFilename;
|
||||||
@ -1481,11 +1475,8 @@ function TStandardCodeTool.FindMissingUnits(var MissingUnits: TStrings;
|
|||||||
and ((NewUnitName<>OldUnitName) or (NewInFilename<>OldInFilename)) then
|
and ((NewUnitName<>OldUnitName) or (NewInFilename<>OldInFilename)) then
|
||||||
begin
|
begin
|
||||||
// fix case
|
// fix case
|
||||||
FromPos:=UnitNameAtom.StartPos;
|
FromPos:=Node.StartPos;
|
||||||
if InAtom.StartPos>0 then
|
ToPos:=Node.EndPos;
|
||||||
ToPos:=InAtom.EndPos
|
|
||||||
else
|
|
||||||
ToPos:=UnitNameAtom.EndPos;
|
|
||||||
SourceChangeCache.Replace(gtNone,gtNone,FromPos,ToPos,s);
|
SourceChangeCache.Replace(gtNone,gtNone,FromPos,ToPos,s);
|
||||||
DebugLn('CheckUsesSection fix case Unit Name(',OldUnitName,'->',NewUnitName,') InFile(',OldInFilename,'->',NewInFilename,')');
|
DebugLn('CheckUsesSection fix case Unit Name(',OldUnitName,'->',NewUnitName,') InFile(',OldInFilename,'->',NewInFilename,')');
|
||||||
end;
|
end;
|
||||||
@ -1494,14 +1485,8 @@ function TStandardCodeTool.FindMissingUnits(var MissingUnits: TStrings;
|
|||||||
if MissingUnits=nil then MissingUnits:=TStringList.Create;
|
if MissingUnits=nil then MissingUnits:=TStringList.Create;
|
||||||
MissingUnits.Add(s);
|
MissingUnits.Add(s);
|
||||||
end;
|
end;
|
||||||
if CurPos.Flag=cafComma then begin
|
Node:=Node.NextBrother;
|
||||||
// read next unit name
|
end;
|
||||||
ReadNextAtom;
|
|
||||||
end else if CurPos.Flag=cafSemicolon then begin
|
|
||||||
break;
|
|
||||||
end else
|
|
||||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[';',GetAtom]);
|
|
||||||
until false;
|
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user