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

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: Created 5 years, 9 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
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..e39f6f5fd931ba5af58ee2a63717387d1a9814a7 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -148,8 +148,10 @@ class _Generator(object):
real_t = self._type_helper.FollowRef(t)
if real_t.property_type == PropertyType.ENUM:
- items.append('%s(%s)' % (
+ items.append('%s(%s%s)' % (
prop.unix_name,
+ ('%s::' % real_t.namespace.unix_name) if
+ real_t.namespace != self._namespace else '',
not at google - send to devlin 2015/04/03 17:04:38 So, the docserver code is all over the place when
Devlin 2015/04/03 19:38:51 Done.
self._type_helper.GetEnumNoneValue(t)))
elif prop.optional:
continue
@@ -290,8 +292,10 @@ class _Generator(object):
underlying_type = self._type_helper.FollowRef(prop.type_)
if underlying_type.property_type == PropertyType.ENUM:
(c.Append('} else {')
- .Append('%%(dst)s->%%(name)s = %s;' %
- self._type_helper.GetEnumNoneValue(prop.type_)))
+ .Append('%%(dst)s->%%(name)s = %s%s;' %
+ (('%s::' % underlying_type.namespace.unix_name) if
not at google - send to devlin 2015/04/03 17:04:38 Ditto. This is even harder to dissect.
Devlin 2015/04/03 19:38:51 Done.
+ underlying_type.namespace != self._namespace else '',
+ self._type_helper.GetEnumNoneValue(prop.type_))))
c.Eblock('}')
else:
(c.Sblock(
@@ -1027,9 +1031,11 @@ 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;' % (
+ c.Append('%s->%s = %s%s;' % (
dst,
prop.unix_name,
+ ('%s::' % underlying_type.namespace.unix_name) if
not at google - send to devlin 2015/04/03 17:04:38 Ditto.
Devlin 2015/04/03 19:38:51 Done.
+ underlying_type.namespace != self._namespace else '',
self._type_helper.GetEnumNoneValue(prop.type_)))
return c

Powered by Google App Engine
This is Rietveld 408576698