From 8c3adf193d25bb21b8e81b883f480bf12e0fbc5c Mon Sep 17 00:00:00 2001 From: Braden Steffaniak Date: Thu, 6 Jul 2023 07:30:00 -0400 Subject: [PATCH] Fix containsErrors being wiped --- src/main/flat/Flat.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/flat/Flat.java b/src/main/flat/Flat.java index 689e8fc9..625df603 100644 --- a/src/main/flat/Flat.java +++ b/src/main/flat/Flat.java @@ -35,6 +35,7 @@ public class Flat { public static String objectClassType = "class"; public static boolean keepSuperCallInConstructor = false; private boolean testClasses; + private boolean containsErrors; public boolean deleteOutputDirectory; @@ -234,6 +235,10 @@ public static void main(String[] args) { try { flat.compile(args, true); flat.compileEngine.compile(); + + if (returnCode == 0 && flat.containsErrors) { + returnCode = 1; + } } catch (Exception e) { e.printStackTrace(); returnCode = 1; @@ -637,6 +642,7 @@ private void createSyntaxTree(boolean generateCode) { compileEngine.tree = tree; if (containsErrors()) { + containsErrors = true; enableFlag(DRY_RUN); completed(false); } @@ -649,7 +655,7 @@ private void createSyntaxTree(boolean generateCode) { log("Number of lines parsed: " + lineCount, true); - if (generateCode) { + if (generateCode && !isFlagEnabled(DRY_RUN)) { long time = System.currentTimeMillis(); long newTime = time;