Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: tools/json_schema_compiler/code.py

Issue 23594008: Initial code generation for features. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698