diff --git a/packages/fcl-passrc/src/pastree.pp b/packages/fcl-passrc/src/pastree.pp index 403c33cee8..371169480c 100644 --- a/packages/fcl-passrc/src/pastree.pp +++ b/packages/fcl-passrc/src/pastree.pp @@ -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; diff --git a/packages/fcl-passrc/src/paswrite.pp b/packages/fcl-passrc/src/paswrite.pp index 7a44aa6712..d67ab47ccb 100644 --- a/packages/fcl-passrc/src/paswrite.pp +++ b/packages/fcl-passrc/src/paswrite.pp @@ -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;