Commit 3c8643fc authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Workaround ChooseFileSystemEntriesType

Bug: 839389
Change-Id: I81e8fe019528dc7c2009c83fed797ef23ad1a15d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2022565
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735352}
parent 00734ede
...@@ -163,10 +163,30 @@ def make_as_enum_function(cg_context): ...@@ -163,10 +163,30 @@ def make_as_enum_function(cg_context):
def make_nested_enum_class_def(cg_context): def make_nested_enum_class_def(cg_context):
assert isinstance(cg_context, CodeGenContext) assert isinstance(cg_context, CodeGenContext)
enum_values = [ enum_values = []
TextNode(name_style.constant(value)) used_names = set()
for value in cg_context.enumeration.values for value in cg_context.enumeration.values:
] name = name_style.constant(value)
# ChooseFileSystemEntriesType is defined as follows:
#
# enum ChooseFileSystemEntriesType {
# "open-file",
# "openFile",
# "save-file",
# "saveFile",
# "open-directory",
# "openDirectory"
# };
#
# Workaround until the old values get gone.
# TODO(https://crbug.com/1020715): Remove the workaround once the issue
# gets resolved.
if name in used_names:
assert (cg_context.enumeration.identifier ==
"ChooseFileSystemEntriesType")
name = name + "2"
enum_values.append(TextNode(name))
used_names.add(name)
return ListNode([ return ListNode([
TextNode("enum class Enum : enum_int_t {"), TextNode("enum class Enum : enum_int_t {"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment