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

bind-gen: Improve type conversion of args with a default value

According to https://crrev.com/c/2325534, updates the implementation
of make_v8_to_blink_value so that it works with string types.

Bug: 839389
Change-Id: I99ecec934b7238bfeef4ad549ef2773a3f17d107
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2337193Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794908}
parent f9d16d9b
......@@ -506,14 +506,18 @@ def make_v8_to_blink_value(blink_var_name,
])
nodes = []
type_info = blink_type_info(idl_type)
arg_type = _format(
"decltype(NativeValueTraits<{}>::NativeValue("
"std::declval<v8::Isolate*>(), "
"std::declval<v8::Local<v8::Value>>(), "
"std::declval<ExceptionState&>()))", native_value_tag(idl_type))
default_expr = make_default_value_expr(idl_type, default_value)
if default_expr.is_initialization_lightweight:
nodes.append(
F("{} ${{{}}}{{{}}};", type_info.value_t, blink_var_name,
F("{} ${{{}}}{{{}}};", arg_type, blink_var_name,
default_expr.initializer_expr))
else:
nodes.append(F("{} ${{{}}};", type_info.value_t, blink_var_name))
nodes.append(F("{} ${{{}}};", arg_type, blink_var_name))
assignment = [
F("${{{}}} = {};", blink_var_name, blink_value_expr),
CxxUnlikelyIfNode(
......
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