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 0cde6cab3193639e7fdc2d5bf7041cfbebf71ac2..aa22ea1b4072d66a12b1efe56f580397056ae518 100644 |
--- a/tools/json_schema_compiler/cc_generator.py |
+++ b/tools/json_schema_compiler/cc_generator.py |
@@ -947,8 +947,7 @@ |
.Concat(self._GenerateStringToEnumConversion(item_type, |
'(it)', |
'tmp', |
- failure_value, |
- is_ptr=False)) |
+ failure_value)) |
.Append('%s%spush_back(tmp);' % (dst_var, accessor)) |
.Eblock('}') |
) |
@@ -958,8 +957,7 @@ |
type_, |
src_var, |
dst_var, |
- failure_value, |
- is_ptr=True): |
+ failure_value): |
"""Returns Code that converts a string type in |src_var| to an enum with |
type |type_| in |dst_var|. In the generated code, if |src_var| is not |
a valid enum name then the function will return |failure_value|. |
@@ -971,14 +969,11 @@ |
cpp_type_namespace = '' |
if type_.namespace != self._namespace: |
cpp_type_namespace = '%s::' % type_.namespace.unix_name |
- accessor = '->' if is_ptr else '.' |
(c.Append('std::string %s;' % enum_as_string) |
- .Sblock('if (!%s%sGetAsString(&%s)) {' % (src_var, |
- accessor, |
- enum_as_string)) |
+ .Sblock('if (!%s->GetAsString(&%s)) {' % (src_var, enum_as_string)) |
.Concat(self._GenerateError( |
'"\'%%(key)s\': expected string, got " + ' + |
- self._util_cc_helper.GetValueTypeString('%%(src_var)s', is_ptr))) |
+ self._util_cc_helper.GetValueTypeString('%%(src_var)s', True))) |
.Append('return %s;' % failure_value) |
.Eblock('}') |
.Append('%s = %sParse%s(%s);' % (dst_var, |