浏览代码

* 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
 implementation
 
 
     uses
     uses
+      sysutils,
       cutils,cclasses,
       cutils,cclasses,
       globtype,version,tokens,systems,globals,verbose,
       globtype,version,tokens,systems,globals,verbose,
       symbase,symtable,symsym,
       symbase,symtable,symsym,
@@ -515,13 +516,25 @@ implementation
          { If the compile level > 1 we get a nice "unit expected" error
          { If the compile level > 1 we get a nice "unit expected" error
            message if we are trying to use a program as unit.}
            message if we are trying to use a program as unit.}
          try
          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
          finally
            { restore old state }
            { restore old state }
            done_module;
            done_module;