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

Unified Diff: tools/json_schema_compiler/h_generator.py

Issue 143473003: Generate ax enums from idl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add allow custom filename property to top level idl. Created 6 years, 11 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/h_generator.py
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py
index 0a2dc89003cb3d23f8f377f13bb2654a2d881e5c..1c347f5b07b7ecff5ce05d60c3f28225cb3b9f5a 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -142,9 +142,10 @@ class _Generator(object):
"""
c = Code()
c.Sblock('enum %s {' % enum_name)
- c.Append(self._type_helper.GetEnumNoneValue(type_) + ',')
for value in type_.enum_values:
c.Append(self._type_helper.GetEnumValue(type_, value) + ',')
+ # Add any non-explicit enum values last.
+ c.Append(self._type_helper.GetEnumNoneValue(type_))
return c.Eblock('};')
def _GenerateFields(self, props):
@@ -206,9 +207,10 @@ class _Generator(object):
if type_.description:
c.Comment(type_.description)
c.Sblock('enum %(classname)s {')
- c.Append('%s,' % self._type_helper.GetEnumNoneValue(type_))
for value in type_.enum_values:
c.Append('%s,' % self._type_helper.GetEnumValue(type_, value))
+ # Add any non-explicit enum values last.
+ c.Append('%s,' % self._type_helper.GetEnumNoneValue(type_))
# Top level enums are in a namespace scope so the methods shouldn't be
# static. On the other hand, those declared inline (e.g. in an object) do.
maybe_static = '' if is_toplevel else 'static '

Powered by Google App Engine
This is Rietveld 408576698