in bindings/scripts/v8_methods.py [0:0]
def argument_context(interface, method, argument, index, is_visible=True):
extended_attributes = argument.extended_attributes
idl_type = argument.idl_type
if is_visible:
idl_type.add_includes_for_type(extended_attributes)
this_cpp_value = cpp_value(interface, method, index)
is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
# [LegacyInterfaceTypeChecking]
has_type_checking_interface = (
not is_legacy_interface_type_checking(interface, method) and
idl_type.is_wrapper_type)
set_default_value = argument.set_default_value
this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes,
raw_type=True,
used_as_variadic_argument=argument.is_variadic)
context = {
'cpp_type': (
v8_types.cpp_template_type('Nullable', this_cpp_type)
if idl_type.is_explicit_nullable and not argument.is_variadic
else this_cpp_type),
'cpp_value': this_cpp_value,
# FIXME: check that the default value's type is compatible with the argument's
'set_default_value': set_default_value,
'enum_type': idl_type.enum_type,
'enum_values': idl_type.enum_values,
'handle': '%sHandle' % argument.name,
# FIXME: remove once [Default] removed and just use argument.default_value
'has_default': 'Default' in extended_attributes or set_default_value,
'has_type_checking_interface': has_type_checking_interface,
# Dictionary is special-cased, but arrays and sequences shouldn't be
'idl_type': idl_type.base_type,
'idl_type_object': idl_type,
'index': index,
'is_callback_function': idl_type.is_callback_function,
'is_callback_interface': idl_type.is_callback_interface,
# FIXME: Remove generic 'Dictionary' special-casing
'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictionary',
'is_explicit_nullable': idl_type.is_explicit_nullable,
'is_nullable': idl_type.is_nullable,
'is_optional': argument.is_optional,
'is_variadic': argument.is_variadic,
'is_variadic_wrapper_type': is_variadic_wrapper_type,
'is_wrapper_type': idl_type.is_wrapper_type,
'name': argument.name,
'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes,
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(interface.name, method, argument, index),
}
context.update({
'is_optional_without_default_value':
context['is_optional'] and
not context['has_default'] and
not context['is_dictionary'] and
not context['is_callback_interface'],
})
return context