Commits

Anonymous committed b22999a

remove System.exit() calls because they are evil (and interfere with unit testing)
replaced with exception

  • Participants
  • Parent commits 77283a0

Comments (0)

Files changed (2)

File src/main/java/sketch/compiler/main/seq/SequentialSketchMain.java

         {
             prog = parseFiles(inputFiles);
         }
-        catch (java.io.IOException e)
+        catch (Exception e)
         {
             e.printStackTrace(System.err);
-            System.exit(1);
-        }
-        catch (antlr.RecognitionException e)
-        {
-            e.printStackTrace(System.err);
-            System.exit(1);
-        }
-        catch (antlr.TokenStreamException e)
-        {
-            e.printStackTrace(System.err);
-            System.exit(1);
+            throw new RuntimeException(e);
         }
 
         if (prog == null)
         {
             System.err.println("Compilation didn't generate a parse tree.");
-            System.exit(1);
+            throw new IllegalStateException();
         }
         
         // RenameBitVars is buggy!! prog = (Program)prog.accept(new RenameBitVars());
         if (!SemanticChecker.check(prog))
-            System.exit(1);
+            throw new IllegalStateException();
         prog = (Program)prog.accept(new AssignLoopTypes());
         if (prog == null)
-            System.exit(1);
+            throw new IllegalStateException();
 
         TempVarGen varGen = new TempVarGen();
         prog = lowerIRToJava(prog, !libraryFormat, varGen);
         catch (java.io.IOException e)
         {
             e.printStackTrace(System.err);
-            System.exit(1);
+            throw new RuntimeException(e);
         }
     }
     

File src/main/java/sketch/compiler/tosbit/NodesToSBit.java

 	    	if(!t){
 	    		System.err.println(s);
 	    		System.err.println( ss.getContext() );
-	    		System.exit(1);
+	    		throw new RuntimeException(s);
 	    	}
 	    }
 	    private int boolToInt(boolean b){