Browse Source

fcl-base: pascodegen: do not write empty line for default section

mattias 3 years ago
parent
commit
bf52952b86
1 changed files with 4 additions and 3 deletions
  1. 4 3
      packages/fcl-base/src/pascodegen.pp

+ 4 - 3
packages/fcl-base/src/pascodegen.pp

@@ -26,7 +26,7 @@ Type
   TCodegenLogType = (cltInfo);
   TCodegenLogType = (cltInfo);
   TCodegenLogTypes = Set of TCodegenLogType;
   TCodegenLogTypes = Set of TCodegenLogType;
   TCodeGeneratorLogEvent = Procedure (Sender : TObject; LogType : TCodegenLogType; Const Msg : String) of object;
   TCodeGeneratorLogEvent = Procedure (Sender : TObject; LogType : TCodegenLogType; Const Msg : String) of object;
-  TCodesection = (csUnknown, csConst, csType, csVar, csResourcestring, csDeclaration);
+  TCodeSection = (csUnknown, csConst, csType, csVar, csResourcestring, csDeclaration);
 
 
   { TPascalCodeGenerator }
   { TPascalCodeGenerator }
 
 
@@ -221,14 +221,15 @@ end;
 procedure TPascalCodeGenerator.EnsureSection(aSection: TCodeSection);
 procedure TPascalCodeGenerator.EnsureSection(aSection: TCodeSection);
 
 
 Const
 Const
-  SectionKeyWords : Array[TCodesection] of string
+  SectionKeyWords : Array[TCodeSection] of string
     = ('', 'Const', 'Type', 'Var', 'Resourcestring', '');
     = ('', 'Const', 'Type', 'Var', 'Resourcestring', '');
 
 
 begin
 begin
   If CurrentSection<>aSection then
   If CurrentSection<>aSection then
     begin
     begin
     CurrentSection:=aSection;
     CurrentSection:=aSection;
-    AddLn(SectionKeyWords[CurrentSection]);
+    if SectionKeyWords[CurrentSection]<>'' then
+      AddLn(SectionKeyWords[CurrentSection]);
     end;
     end;
 end;
 end;