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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 260893013: JSON Schema Compiler: Following r267534, properly convert arrays of enums (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better Created 6 years, 8 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
« no previous file with comments | « no previous file | tools/json_schema_compiler/util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 978ab9362726b5cbc39f9f8b16f21309b21e1a40..a709c038acc37865aba01ed08e74d925a943107d 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -500,11 +500,18 @@ class _Generator(object):
return ('base::BinaryValue::CreateWithCopiedBuffer(%sdata(), %ssize())' %
(vardot, vardot))
elif underlying_type.property_type == PropertyType.ARRAY:
+ item_type = underlying_type.item_type
+ # Any enum will only have a namespace if it's not a ref, hence the lack
+ # of FollowRef(item_type) here and just directly comparing to ENUM.
+ enum_namespace = None
+ if item_type.property_type == PropertyType.ENUM:
+ enum_namespace = cpp_namespace
return '%s.release()' % self._util_cc_helper.CreateValueFromArray(
- cpp_namespace,
- underlying_type,
var,
- is_ptr)
+ optional=is_ptr,
+ is_enum=self._type_helper.FollowRef(item_type).property_type ==
+ PropertyType.ENUM,
+ enum_namespace=enum_namespace)
elif underlying_type.property_type.is_fundamental:
if is_ptr:
var = '*%s' % var
« no previous file with comments | « no previous file | tools/json_schema_compiler/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698