diff --git a/compiler/__main__.py b/compiler/__main__.py index 7ba4568..fb2e246 100644 --- a/compiler/__main__.py +++ b/compiler/__main__.py @@ -74,14 +74,13 @@ def main(): except CompilationError as e: e.location.source = data - print(f"{e}\n{e.location.show_in_source()}", file=sys.stderr) + print(f"{e}\n{e.location.show_in_source()}", flush=True) if e.__cause__ is not None: if rootLogger.level <= LogLevel.Debug: raise e.__cause__ - print(f"Caused by:\n{e.__cause__.__class__.__name__}: {e.__cause__}", file=sys.stderr) + print(f"Caused by:\n{e.__cause__.__class__.__name__}: {e.__cause__}", flush=True) finally: - CompilationWarning.show_warnings(data) def print_ir(intermediate_representation: list[ir.IRAction]): @@ -95,6 +94,7 @@ def print_ir(intermediate_representation: list[ir.IRAction]): messages += [f"{repr(ir_item)}\n"] print("\n".join(messages)) + CompilationWarning.show_warnings(data, file=sys.stdout) if __name__ == "__main__":