Chromium Code Reviews| Index: tools/json_schema_compiler/cc_generator.py |
| diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py |
| index 73413efaeadf2300339b79763ece40a4452dd6db..6faac39751815d5910326658b21d4bb6583fde5a 100644 |
| --- a/tools/json_schema_compiler/cc_generator.py |
| +++ b/tools/json_schema_compiler/cc_generator.py |
| @@ -363,11 +363,16 @@ class _Generator(object): |
| for prop in type_.properties.values(): |
| prop_var = 'this->%s' % prop.unix_name |
| if prop.optional: |
| - # Optional enum values are generated with a NONE enum value. |
| underlying_type = self._type_helper.FollowRef(prop.type_) |
| if underlying_type.property_type == PropertyType.ENUM: |
| - c.Sblock('if (%s != %s) {' % |
| + # Optional enum values are generated with a NONE enum value, |
| + # potentially from another namespace. |
| + maybe_namespace = '' |
| + if underlying_type.namespace != self._namespace: |
| + maybe_namespace = '%s::' % underlying_type.namespace.unix_name |
| + c.Sblock('if (%s != %s%s) {' % |
|
Devlin
2015/04/23 23:26:51
Honestly, we should probably just fully specify ev
not at google - send to devlin
2015/04/23 23:28:45
Hah, yes, that would make things simpler.
|
| (prop_var, |
| + maybe_namespace, |
| self._type_helper.GetEnumNoneValue(prop.type_))) |
| else: |
| c.Sblock('if (%s.get()) {' % prop_var) |