From 944deb38084e5e5bc82182faab2db2be156b971c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 26 May 2019 00:55:10 +0300 Subject: [PATCH] Improve formatting of an empty loop body --- source/programcompiler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index 2bf57c6a..fd9c50db 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -560,7 +560,14 @@ void ProgramCompiler::Formatter::visit(Iteration &iter) iter.loop_expression->visit(*this); } formatted += ')'; - iter.body.visit(*this); + + if(iter.body.body.empty()) + formatted += " { }"; + else + { + formatted += '\n'; + iter.body.visit(*this); + } } void ProgramCompiler::Formatter::visit(Return &ret) -- 2.45.2