diff options
author | Hokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 14:28:21 +0000 |
---|---|---|
committer | Hokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 14:28:21 +0000 |
commit | 1938a5697e536ddb2af79e8354b8612dd9dc6e71 (patch) | |
tree | ddd6f978e18eed2cfdb190643d82ae838bb30992 /tools/json_schema_compiler | |
parent | e5ff5c9e8ee975ef21dce357ae42bbcc42f65c26 (diff) | |
download | chromium_src-1938a5697e536ddb2af79e8354b8612dd9dc6e71.zip chromium_src-1938a5697e536ddb2af79e8354b8612dd9dc6e71.tar.gz chromium_src-1938a5697e536ddb2af79e8354b8612dd9dc6e71.tar.bz2 |
Ignore unnecessary brackets in JSON/IDL API generated code.
BUG=322752
TEST=compiled
Review URL: https://codereview.chromium.org/95543002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler')
-rw-r--r-- | tools/json_schema_compiler/cc_generator.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 371c60d..4193c03 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -590,7 +590,6 @@ class _Generator(object): |failure_value|. """ c = Code() - c.Sblock('{') underlying_type = self._type_helper.FollowRef(type_) @@ -721,14 +720,16 @@ class _Generator(object): ) else: raise NotImplementedError(type_) - return c.Eblock('}').Substitute({ + if c.IsEmpty(): + return c + return Code().Sblock('{').Concat(c.Substitute({ 'cpp_type': self._type_helper.GetCppType(type_), 'src_var': src_var, 'dst_var': dst_var, 'failure_value': failure_value, 'key': type_.name, 'parent_key': type_.parent.name - }) + })).Eblock('}') def _GenerateListValueToEnumArrayConversion(self, item_type, |