From: Stefan Behnel Date: Fri, 11 Jul 2008 12:32:07 +0000 (+0200) Subject: fix code writer indentation correct for '} else {' X-Git-Tag: 0.9.8.1~123^2~23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5e1164c6b31d107be9ec64660a610fa9f75f04fa;p=cython.git fix code writer indentation correct for '} else {' --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index afba02f8..ce615cf1 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -64,13 +64,17 @@ class CCodeWriter: dl = code.count("{") - code.count("}") if dl < 0: self.level += dl + elif dl == 0 and code.startswith('}'): + self.level -= 1 if self.bol: self.indent() self._write(code) self.bol = 0 if dl > 0: self.level += dl - + elif dl == 0 and code.startswith('}'): + self.level += 1 + def increase_indent(self): self.level = self.level + 1