瀏覽代碼

pastojs: catch ECompilerTerminate while parsing params

git-svn-id: trunk@40305 -
Mattias Gaertner 6 年之前
父節點
當前提交
2b36f8d177
共有 1 個文件被更改,包括 33 次插入33 次删除
  1. 33 33
      packages/pastojs/src/pas2jscompiler.pp

+ 33 - 33
packages/pastojs/src/pas2jscompiler.pp

@@ -4223,47 +4223,47 @@ begin
   if FileCount>0 then
     RaiseInternalError(20170504161340,'internal error: TPas2jsCompiler.Run FileCount>0');
 
-  // ste working directory, need by all relative filenames
-  FileCache.BaseDirectory:=aWorkingDir;
+  try
+    // set working directory, need by all relative filenames
+    FileCache.BaseDirectory:=aWorkingDir;
 
-  CompilerExe:=aCompilerExe; // maybe needed to find the default config
+    CompilerExe:=aCompilerExe; // maybe needed to find the default config
 
-  // quick check command line params
-  for i:=0 to ParamList.Count-1 do
-    ReadParam(ParamList[i],true,true);
-  if WriteDebugLog then
-    Log.OpenDebugLog;
-  if ShowLogo then
-    WriteLogo;
+    // quick check command line params
+    for i:=0 to ParamList.Count-1 do
+      ReadParam(ParamList[i],true,true);
+    if WriteDebugLog then
+      Log.OpenDebugLog;
+    if ShowLogo then
+      WriteLogo;
 
-  // read default config
-  if not SkipDefaultConfig then
-    LoadDefaultConfig;
+    // read default config
+    if not SkipDefaultConfig then
+      LoadDefaultConfig;
 
-  // read command line parameters
-  for i:=0 to ParamList.Count-1 do
-    ReadParam(ParamList[i],false,true);
+    // read command line parameters
+    for i:=0 to ParamList.Count-1 do
+      ReadParam(ParamList[i],false,true);
 
-  // now we know, if the logo can be displayed
-  if ShowLogo then
-    WriteLogo;
+    // now we know, if the logo can be displayed
+    if ShowLogo then
+      WriteLogo;
 
-  // show debug info
-  if ShowDebug then
-  begin
-    WriteOptions;
-    WriteDefines;
-  end;
-  if ShowDebug or ShowTriedUsedFiles then
-    WriteFoldersAndSearchPaths;
+    // show debug info
+    if ShowDebug then
+    begin
+      WriteOptions;
+      WriteDefines;
+    end;
+    if ShowDebug or ShowTriedUsedFiles then
+      WriteFoldersAndSearchPaths;
 
-  if FileCache.MainSrcFile='' then
-    ParamFatal('No source file name in command line');
-  if not DirectoryCache.FileExists(FileCache.MainSrcFile) then
-    ParamFatal('Pascal file not found: "'+FileCache.MainSrcFile+'"');
+    if FileCache.MainSrcFile='' then
+      ParamFatal('No source file name in command line');
+    if not DirectoryCache.FileExists(FileCache.MainSrcFile) then
+      ParamFatal('Pascal file not found: "'+FileCache.MainSrcFile+'"');
 
-  // compile
-  try
+    // compile
     Compile(StartTime);
   except
     on E: ECompilerTerminate do