Commit 65fc95ff authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Implement/improve blink_api_call to support optional args

Implements support of optional arguments.

Bug: 839389
Change-Id: I1e35774a52fc18786eb712b2dcc6d9456faea5d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942895Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720831}
parent e59d30f9
......@@ -100,6 +100,7 @@ def blink_type_info(idl_type):
blink_impl_type,
member_fmt="Member<{}>",
ref_fmt="{}*",
value_fmt="{}*",
is_nullable=True)
if (real_type.is_sequence or real_type.is_frozen_array
......@@ -168,13 +169,18 @@ def native_value_tag(idl_type):
return "IDLNullable<{}>".format(native_value_tag(real_type.inner_type))
def make_v8_to_blink_value(blink_var_name, v8_value_expr, idl_type):
def make_v8_to_blink_value(blink_var_name,
v8_value_expr,
idl_type,
default_value=None):
"""
Returns a SymbolNode whose definition converts a v8::Value to a Blink value.
"""
assert isinstance(blink_var_name, str)
assert isinstance(v8_value_expr, str)
assert isinstance(idl_type, web_idl.IdlType)
assert (default_value is None
or isinstance(default_value, web_idl.LiteralConstant))
pattern = (
"const auto& ${{{_1}}} = NativeValueTraits<{_2}>::NativeValue({_3});")
......
......@@ -47,6 +47,7 @@ from .function_like import FunctionLike
from .function_like import OverloadGroup
from .idl_type import IdlType
from .interface import Interface
from .literal_constant import LiteralConstant
from .namespace import Namespace
from .operation import Operation
from .operation import OperationGroup
......
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