summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/h_generator.py
diff options
context:
space:
mode:
authorwjywbs@gmail.com <wjywbs@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 11:06:44 +0000
committerwjywbs@gmail.com <wjywbs@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 11:06:44 +0000
commit29189e1dce5e4cee4d29e5e8a86494f60f597fa9 (patch)
tree1ac0c4e8a75f922f7649a9d283554b59540bff25 /tools/json_schema_compiler/h_generator.py
parentd32a92657ebd66f4fb29bde9bb94bf2b2a1d2cd9 (diff)
downloadchromium_src-29189e1dce5e4cee4d29e5e8a86494f60f597fa9.zip
chromium_src-29189e1dce5e4cee4d29e5e8a86494f60f597fa9.tar.gz
chromium_src-29189e1dce5e4cee4d29e5e8a86494f60f597fa9.tar.bz2
Fix compile error if both inline and reference enums are used in a type.
The ToString() overloading function of inline and reference enums will conflict because they exist in both global namespace and local classes. This is a workaround to generate EnumNameToString() and use it in ToValue() of the type. ToString() is still generated for compatibility because some other code still use it. R=kalman@chromium.org BUG=371042 Review URL: https://codereview.chromium.org/270523005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/h_generator.py')
-rw-r--r--tools/json_schema_compiler/h_generator.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py
index fbb79e3..a7cac43 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -214,6 +214,8 @@ class _Generator(object):
# static. On the other hand, those declared inline (e.g. in an object) do.
maybe_static = '' if is_toplevel else 'static '
(c.Append()
+ .Append('%sstd::string %sToString(%s as_enum);' %
+ (maybe_static, classname, classname))
.Append('%sstd::string ToString(%s as_enum);' %
(maybe_static, classname))
.Append('%s%s Parse%s(const std::string& as_string);' %