소스 검색

* increase errorcount if an unknown exception occurred. This
prevents some error checking during the cleanup

git-svn-id: trunk@591 -

peter 20 년 전
부모
커밋
4e14322037
1개의 변경된 파일20개의 추가작업 그리고 7개의 파일을 삭제
  1. 20 7
      compiler/parser.pas

+ 20 - 7
compiler/parser.pas

@@ -35,6 +35,7 @@ interface
 implementation
 
     uses
+      sysutils,
       cutils,cclasses,
       globtype,version,tokens,systems,globals,verbose,
       symbase,symtable,symsym,
@@ -515,13 +516,25 @@ implementation
          { If the compile level > 1 we get a nice "unit expected" error
            message if we are trying to use a program as unit.}
          try
-           if (token=_UNIT) or (compile_level>1) then
-             begin
-               current_module.is_unit:=true;
-               proc_unit;
-             end
-           else
-             proc_program(token=_LIBRARY);
+           try
+             if (token=_UNIT) or (compile_level>1) then
+               begin
+                 current_module.is_unit:=true;
+                 proc_unit;
+               end
+             else
+               proc_program(token=_LIBRARY);
+           except
+             on ECompilerAbort do
+               raise;
+             on Exception do
+               begin
+                 { Increase errorcounter to prevent some
+                   checks during cleanup }
+                 inc(status.errorcount);
+                 raise;
+               end;
+           end;
          finally
            { restore old state }
            done_module;