Index: tools/json_schema_compiler/code.py |
diff --git a/tools/json_schema_compiler/code.py b/tools/json_schema_compiler/code.py |
index 3622237a84ae30bfb8238a07ab14859739da847f..b549bfc516f6eb347cb39f2d1cd8e9ab711787a9 100644 |
--- a/tools/json_schema_compiler/code.py |
+++ b/tools/json_schema_compiler/code.py |
@@ -63,24 +63,28 @@ class Code(object): |
self.Concat(code).Append() |
return self |
- def Sblock(self, line=None): |
+ def Sblock(self, line=None, indent_size=None): |
"""Starts a code block. |
Appends a line of code and then increases the indent level. |
""" |
+ if indent_size is None: |
+ indent_size = self._indent_size; |
if line is not None: |
self.Append(line) |
- self._indent_level += self._indent_size |
+ self._indent_level += indent_size |
return self |
- def Eblock(self, line=None): |
+ def Eblock(self, line=None, indent_size=None): |
"""Ends a code block by decreasing and then appending a line (or a blank |
line if not given). |
""" |
+ if indent_size is None: |
+ indent_size = self._indent_size; |
# TODO(calamity): Decide if type checking is necessary |
#if not isinstance(line, basestring): |
# raise TypeError |
- self._indent_level -= self._indent_size |
+ self._indent_level -= indent_size |
if line is not None: |
self.Append(line) |
return self |