Chromium Code Reviews| 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..d8953416ee5e60ee6a7a75a646a01bfd0d01928a 100644 |
| --- a/tools/json_schema_compiler/h_generator.py |
| +++ b/tools/json_schema_compiler/h_generator.py |
| @@ -142,9 +142,9 @@ 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) + ',') |
| + c.Append(self._type_helper.GetEnumNoneValue(type_)) |
| return c.Eblock('};') |
| def _GenerateFields(self, props): |
| @@ -206,9 +206,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_)) |
|
not at google - send to devlin
2014/01/23 00:04:40
Explain this a bit more (why you need it last). I
David Tseng
2014/01/23 00:31:43
This is mostly paranoia on my part because of the
|
| # 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 ' |