Commit 5e1164c6 authored by Stefan Behnel's avatar Stefan Behnel

fix code writer indentation correct for '} else {'

parent e42ddaa8
...@@ -64,12 +64,16 @@ class CCodeWriter: ...@@ -64,12 +64,16 @@ class CCodeWriter:
dl = code.count("{") - code.count("}") dl = code.count("{") - code.count("}")
if dl < 0: if dl < 0:
self.level += dl self.level += dl
elif dl == 0 and code.startswith('}'):
self.level -= 1
if self.bol: if self.bol:
self.indent() self.indent()
self._write(code) self._write(code)
self.bol = 0 self.bol = 0
if dl > 0: if dl > 0:
self.level += dl self.level += dl
elif dl == 0 and code.startswith('}'):
self.level += 1
def increase_indent(self): def increase_indent(self):
self.level = self.level + 1 self.level = self.level + 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment