]> git.tdb.fi Git - libs/gl.git/commitdiff
Improve formatting of an empty loop body
authorMikko Rasa <tdb@tdb.fi>
Sat, 25 May 2019 21:55:10 +0000 (00:55 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 25 May 2019 21:55:10 +0000 (00:55 +0300)
source/programcompiler.cpp

index 2bf57c6ad8fe4788ad9417b0f73123eb2351a0b2..fd9c50dbbb5c2879e55fb528035f7527aef126ff 100644 (file)
@@ -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)