fcl-passrc: similar to r36619. New option SemicolonAtEOL for better control of TPasImplCommand (previously, semicolon was implicitly added for command for generated pascal code by paswrite.pp module for TPasImplCommand)

git-svn-id: trunk@36621 -
This commit is contained in:
maciej-izak 2017-06-30 22:47:18 +00:00
parent ad65ff5600
commit 99f7c010a8
2 changed files with 18 additions and 2 deletions

View File

@ -1108,8 +1108,11 @@ Type
{ TPasImplCommand - currently used as empty statement, e.g. if then else ; }
TPasImplCommand = class(TPasImplElement)
public
constructor Create(const AName: string; AParent: TPasElement); override;
public
Command: string; // never set by TPasParser
SemicolonAtEOL: boolean;
end;
{ TPasImplCommands - used by mkxmlrpc, not used by pparser }
@ -1521,6 +1524,14 @@ begin
El:=nil;
end;
{ TPasImplCommand }
constructor TPasImplCommand.Create(const AName: string; AParent: TPasElement);
begin
inherited Create(AName, AParent);
SemicolonAtEOL := true;
end;
{ TInlineTypeExpr }
destructor TInlineTypeExpr.Destroy;

View File

@ -458,8 +458,13 @@ begin
for i := 0 to ABlock.Elements.Count - 1 do
begin
WriteImplElement(TPasImplElement(ABlock.Elements[i]), False);
if TPasImplElement(ABlock.Elements[i]).ClassType = TPasImplCommand then
wrtln(';');
if (TPasImplElement(ABlock.Elements[i]).ClassType = TPasImplCommand) then
begin
if TPasImplCommand(ABlock.Elements[i]).SemicolonAtEOL then
wrtln(';')
else
wrtln;
end;
end;
end;