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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 1055673002: [Extensions API] Remove inline enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 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 | « extensions/shell/browser/shell_runtime_api_delegate.cc ('k') | tools/json_schema_compiler/compiler.py » ('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 3e2a1be6eff997bf79b2dd5099e31adce192bc20..73413efaeadf2300339b79763ece40a4452dd6db 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -148,9 +148,12 @@ class _Generator(object):
real_t = self._type_helper.FollowRef(t)
if real_t.property_type == PropertyType.ENUM:
- items.append('%s(%s)' % (
- prop.unix_name,
- self._type_helper.GetEnumNoneValue(t)))
+ namespace_prefix = ('%s::' % real_t.namespace.unix_name
+ if real_t.namespace != self._namespace
+ else '')
+ items.append('%s(%s%s)' % (prop.unix_name,
+ namespace_prefix,
+ self._type_helper.GetEnumNoneValue(t)))
elif prop.optional:
continue
elif t.property_type == PropertyType.INTEGER:
@@ -289,9 +292,13 @@ class _Generator(object):
prop, value_var, dst, 'false')))
underlying_type = self._type_helper.FollowRef(prop.type_)
if underlying_type.property_type == PropertyType.ENUM:
+ namespace_prefix = ('%s::' % underlying_type.namespace.unix_name
+ if underlying_type.namespace != self._namespace
+ else '')
(c.Append('} else {')
- .Append('%%(dst)s->%%(name)s = %s;' %
- self._type_helper.GetEnumNoneValue(prop.type_)))
+ .Append('%%(dst)s->%%(name)s = %s%s;' %
+ (namespace_prefix,
+ self._type_helper.GetEnumNoneValue(prop.type_))))
c.Eblock('}')
else:
(c.Sblock(
@@ -1027,9 +1034,13 @@ class _Generator(object):
underlying_type = self._type_helper.FollowRef(prop.type_)
if (underlying_type.property_type == PropertyType.ENUM and
prop.optional):
- c.Append('%s->%s = %s;' % (
+ namespace_prefix = ('%s::' % underlying_type.namespace.unix_name
+ if underlying_type.namespace != self._namespace
+ else '')
+ c.Append('%s->%s = %s%s;' % (
dst,
prop.unix_name,
+ namespace_prefix,
self._type_helper.GetEnumNoneValue(prop.type_)))
return c
« no previous file with comments | « extensions/shell/browser/shell_runtime_api_delegate.cc ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698