Commit f529ce5e authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Minor fix of "enumerated attributes"

Defaults to g_empty_atom if no [ReflectInvalid=].

Renames a helper function.  'enumerated attributes' mean IDL
attributes that have a set of finite string values.  The
helper function handles the mapping between keywrod and state
for a given enumerated attribute.

Bug: 839389
Change-Id: I8e77ef20de5efa34c943dcda414732c1c5153e90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961844Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724512}
parent 0b845b01
......@@ -240,7 +240,7 @@ def _make_reflect_accessor_func_name(cg_context):
return "setAttribute"
def _make_reflect_process_enumerated_attributes(cg_context):
def _make_reflect_process_keyword_state(cg_context):
# https://html.spec.whatwg.org/C/#keywords-and-enumerated-attributes
assert isinstance(cg_context, CodeGenContext)
......@@ -293,6 +293,9 @@ def _make_reflect_process_enumerated_attributes(cg_context):
branches.append(
cond=True,
body=F("${return_value} = {};", constant(invalid_default)))
else:
branches.append(
cond=True, body=F("${return_value} = {};", constant("")))
return SequenceNode(nodes)
......@@ -426,7 +429,7 @@ def bind_return_value(code_node, cg_context):
if "ReflectOnly" in cg_context.member_like.extended_attributes:
# [ReflectOnly]
node = _make_reflect_process_enumerated_attributes(cg_context)
node = _make_reflect_process_keyword_state(cg_context)
if node:
nodes.append(T(""))
nodes.append(node)
......
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