fcl-passrc: passrcutil, paswrite: using usesclause

git-svn-id: trunk@35964 -
This commit is contained in:
Mattias Gaertner 2017-04-27 11:45:36 +00:00
parent 0a88d5465f
commit 09504f95f9
3 changed files with 27 additions and 13 deletions

View File

@ -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;

View File

@ -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}

View File

@ -185,6 +185,16 @@ begin
if ASection.UsesList.Count>0 then if ASection.UsesList.Count>0 then
begin begin
wrt('uses '); wrt('uses ');
if length(ASection.UsesClause)=ASection.UsesList.Count then
for i := 0 to length(ASection.UsesClause)-1 do
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 for i := 0 to ASection.UsesList.Count - 1 do
begin begin
if i > 0 then if i > 0 then