mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-27 09:11:31 +01:00
fcl-passrc: passrcutil, paswrite: using usesclause
git-svn-id: trunk@35964 -
This commit is contained in:
parent
0a88d5465f
commit
09504f95f9
@ -192,7 +192,11 @@ procedure TPasSrcAnalysis.GetUses(ASection : TPasSection; List: TStrings);
|
|||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
begin
|
begin
|
||||||
If Assigned(ASection) and Assigned(ASection.UsesList) then
|
If not Assigned(ASection) then exit;
|
||||||
|
if ASection.UsesList.Count=length(ASection.UsesClause) then
|
||||||
|
For I:=0 to length(ASection.UsesClause)-1 do
|
||||||
|
List.Add(ASection.UsesClause[i].Identifier)
|
||||||
|
else
|
||||||
For I:=0 to ASection.UsesList.Count-1 do
|
For I:=0 to ASection.UsesList.Count-1 do
|
||||||
List.Add(TPasElement(ASection.UsesList[i]).Name);
|
List.Add(TPasElement(ASection.UsesList[i]).Name);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -4016,11 +4016,11 @@ var
|
|||||||
begin
|
begin
|
||||||
{$IFDEF VerbosePasTreeMem}writeln('TPasSection.Destroy UsesList');{$ENDIF}
|
{$IFDEF VerbosePasTreeMem}writeln('TPasSection.Destroy UsesList');{$ENDIF}
|
||||||
for i := 0 to UsesList.Count - 1 do
|
for i := 0 to UsesList.Count - 1 do
|
||||||
begin
|
|
||||||
TPasType(UsesList[i]).Release;
|
TPasType(UsesList[i]).Release;
|
||||||
UsesClause[i].Release;
|
|
||||||
end;
|
|
||||||
FreeAndNil(UsesList);
|
FreeAndNil(UsesList);
|
||||||
|
{$IFDEF VerbosePasTreeMem}writeln('TPasSection.Destroy UsesClause');{$ENDIF}
|
||||||
|
for i := 0 to length(UsesClause) - 1 do
|
||||||
|
UsesClause[i].Release;
|
||||||
SetLength(UsesClause,0);
|
SetLength(UsesClause,0);
|
||||||
|
|
||||||
{$IFDEF VerbosePasTreeMem}writeln('TPasSection.Destroy inherited');{$ENDIF}
|
{$IFDEF VerbosePasTreeMem}writeln('TPasSection.Destroy inherited');{$ENDIF}
|
||||||
|
|||||||
@ -182,18 +182,28 @@ procedure TPasWriter.WriteSection(ASection: TPasSection);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if ASection.UsesList.Count > 0 then
|
if ASection.UsesList.Count>0 then
|
||||||
begin
|
|
||||||
wrt('uses ');
|
|
||||||
for i := 0 to ASection.UsesList.Count - 1 do
|
|
||||||
begin
|
begin
|
||||||
if i > 0 then
|
wrt('uses ');
|
||||||
wrt(', ');
|
if length(ASection.UsesClause)=ASection.UsesList.Count then
|
||||||
wrt(TPasElement(ASection.UsesList[i]).Name);
|
for i := 0 to length(ASection.UsesClause)-1 do
|
||||||
end;
|
begin
|
||||||
|
if i > 0 then
|
||||||
|
wrt(', ');
|
||||||
|
wrt(ASection.UsesClause[i].Identifier);
|
||||||
|
if ASection.UsesClause[i].InFilename is TPrimitiveExpr then
|
||||||
|
wrt(' in '''+TPrimitiveExpr(ASection.UsesClause[i].InFilename).Value+'''');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i := 0 to ASection.UsesList.Count - 1 do
|
||||||
|
begin
|
||||||
|
if i > 0 then
|
||||||
|
wrt(', ');
|
||||||
|
wrt(TPasElement(ASection.UsesList[i]).Name);
|
||||||
|
end;
|
||||||
wrtln(';');
|
wrtln(';');
|
||||||
wrtln;
|
wrtln;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CurDeclSection := '';
|
CurDeclSection := '';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user