Commit ec9c424b authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Chromium LUCI CQ

bindings: Limit IDLOptional use case only in arguments

We design IDL dictionary members separated from IDLOptional, and hence
we use IDLOptional only in arguments.

This CL makes a utility function native_value_tag to output IDLOptional
iff its target is an argument.


Bug: 839389
Change-Id: I3b95e870b38ed4e1917408cac0a923a17db88307
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2589233Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837048}
parent 8165bedc
......@@ -254,10 +254,9 @@ def native_value_tag(idl_type, argument=None):
assert isinstance(idl_type, web_idl.IdlType)
assert argument is None or isinstance(argument, web_idl.Argument)
if (idl_type.is_optional
and not (idl_type.is_nullable or
(argument and argument.default_value) or
(argument and argument == argument.owner.arguments[-1]))):
if (idl_type.is_optional and argument
and not (idl_type.is_nullable or argument.default_value
or argument == argument.owner.arguments[-1])):
return "IDLOptional<{}>".format(_native_value_tag_impl(idl_type))
return _native_value_tag_impl(idl_type)
......
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