Browse Source

* Fix bug ID #31702, no semicolon required before finalization

git-svn-id: trunk@35933 -
michael 8 years ago
parent
commit
4d6174f9ef
2 changed files with 16 additions and 0 deletions
  1. 2 0
      packages/fcl-passrc/src/pparser.pp
  2. 14 0
      packages/fcl-passrc/tests/tcstatements.pas

+ 2 - 0
packages/fcl-passrc/src/pparser.pp

@@ -4653,6 +4653,8 @@ begin
       end;
     tkSemiColon:
       if CloseStatement(true) then break;
+    tkFinalization:
+      if CloseStatement(true) then break;
     tkuntil:
       begin
         if CloseStatement(true) then

+ 14 - 0
packages/fcl-passrc/tests/tcstatements.pas

@@ -117,6 +117,7 @@ Type
     Procedure TestAsmBlockInIfThen;
     Procedure TestGotoInIfThen;
     procedure AssignToAddress;
+    procedure FinalizationNoSemicolon;
   end;
 
 implementation
@@ -1703,6 +1704,19 @@ begin
   ParseModule;
 end;
 
+procedure TTestStatementParser.FinalizationNoSemicolon;
+begin
+  Source.Add('unit afile;');
+  Source.Add('{$mode objfpc}');
+  Source.Add('interface');
+  Source.Add('implementation');
+  Source.Add('initialization');
+  Source.Add('  writeln(''qqq'')');
+  Source.Add('finalization');
+  Source.Add('  writeln(''qqq'')');
+  ParseModule;
+end;
+
 Procedure TTestStatementParser.TestGotoInIfThen;
 
 begin