From: Mikko Rasa Date: Sat, 25 May 2019 21:55:10 +0000 (+0300) Subject: Improve formatting of an empty loop body X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=944deb38084e5e5bc82182faab2db2be156b971c;p=libs%2Fgl.git Improve formatting of an empty loop body --- 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)