| Index: Source/bindings/templates/methods.cpp
|
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
|
| index e33041bb0a4df4aa0bb441c9ceda7aa41767648e..85bb19408844248a99a4a1b59a5838013e6c0ebd 100644
|
| --- a/Source/bindings/templates/methods.cpp
|
| +++ b/Source/bindings/templates/methods.cpp
|
| @@ -61,19 +61,23 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
|
| {######################################}
|
| {% macro generate_arguments(method, world_suffix) %}
|
| {% for argument in method.arguments %}
|
| -{{generate_argument_var_declaration(argument)}};
|
| -{% endfor %}
|
| +{{generate_argument_var_declaration(argument)}}
|
| +{%- endfor %}
|
| {
|
| {% if method.arguments_need_try_catch %}
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| {% endif %}
|
| {% for argument in method.arguments %}
|
| - {% if argument.default_value %}
|
| + {% if argument.is_optional %}
|
| if (!info[{{argument.index}}]->IsUndefined()) {
|
| {{generate_argument(method, argument, world_suffix) | indent(8)}}
|
| } else {
|
| + {% if argument.default_value %}
|
| {{argument.name}} = {{argument.default_value}};
|
| + {% else %}
|
| + {{argument.name}}Missing = true;
|
| + {% endif %}
|
| }
|
| {% else %}
|
| {{generate_argument(method, argument, world_suffix) | indent}}
|
| @@ -88,39 +92,24 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
|
| {% if argument.is_callback_interface %}
|
| {# FIXME: remove EventListener special case #}
|
| {% if argument.idl_type == 'EventListener' %}
|
| -RefPtr<{{argument.idl_type}}> {{argument.name}}
|
| -{%- else %}
|
| -OwnPtr<{{argument.idl_type}}> {{argument.name}}
|
| -{%- endif %}{# argument.idl_type == 'EventListener' #}
|
| +RefPtr<{{argument.idl_type}}> {{argument.name}};
|
| +{% else %}
|
| +OwnPtr<{{argument.idl_type}}> {{argument.name}};
|
| +{% endif %}{# argument.idl_type == 'EventListener' #}
|
| {%- elif argument.is_clamp %}{# argument.is_callback_interface #}
|
| {# NaN is treated as 0: http://www.w3.org/TR/WebIDL/#es-type-mapping #}
|
| -{{argument.cpp_type}} {{argument.name}} = 0
|
| -{%- else %}
|
| -{{argument.cpp_type}} {{argument.name}}
|
| -{%- endif %}
|
| -{% endmacro %}
|
| +{{argument.cpp_type}} {{argument.name}} = 0;
|
| +{% else %}
|
| +{{argument.cpp_type}} {{argument.name}}{% if argument.is_explicit_optional %}{{argument.cpp_type_initializer}}{% endif %};
|
| +{% endif %}
|
| +{% if argument.is_explicit_optional %}
|
| +bool {{argument.name}}Missing = false;
|
| +{% endif %}
|
| +{%- endmacro %}
|
|
|
|
|
| {######################################}
|
| {% macro generate_argument(method, argument, world_suffix) %}
|
| -{% if argument.is_optional and not argument.has_default and
|
| - argument.idl_type != 'Dictionary' and
|
| - not argument.is_callback_interface %}
|
| -{# Optional arguments without a default value generate an early call with
|
| - fewer arguments if they are omitted.
|
| - Optional Dictionary arguments default to empty dictionary. #}
|
| -if (UNLIKELY(info.Length() <= {{argument.index}})) {
|
| - {% if world_suffix %}
|
| - {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argument.cpp_value) | indent}}
|
| - {% else %}
|
| - {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}}
|
| - {% endif %}
|
| - {% if argument.has_event_listener_argument %}
|
| - {{hidden_dependency_action(method.name) | indent}}
|
| - {% endif %}
|
| - return;
|
| -}
|
| -{% endif %}
|
| {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_type %}
|
| {# Type checking for wrapper interface types (if interface not implemented,
|
| throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface
|
|
|