OLD | NEW |
1 {##############################################################################} | 1 {##############################################################################} |
2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
5 { | 5 { |
6 {# Local variables #} | 6 {# Local variables #} |
7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
9 {% endif %} | 9 {% endif %} |
10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 {% macro generate_arguments(method, world_suffix) %} | 77 {% macro generate_arguments(method, world_suffix) %} |
78 {% for argument in method.arguments %} | 78 {% for argument in method.arguments %} |
79 {{generate_argument_var_declaration(argument)}}; | 79 {{generate_argument_var_declaration(argument)}}; |
80 {% endfor %} | 80 {% endfor %} |
81 { | 81 { |
82 {% if method.arguments_need_try_catch %} | 82 {% if method.arguments_need_try_catch %} |
83 v8::TryCatch block; | 83 v8::TryCatch block; |
84 V8RethrowTryCatchScope rethrow(block); | 84 V8RethrowTryCatchScope rethrow(block); |
85 {% endif %} | 85 {% endif %} |
86 {% for argument in method.arguments %} | 86 {% for argument in method.arguments %} |
| 87 {% if argument.default_value %} |
| 88 if (info.Length() > {{argument.index}}) { |
| 89 {{generate_argument(method, argument, world_suffix) | indent(8)}} |
| 90 } else { |
| 91 {{argument.name}} = {{argument.default_value}}; |
| 92 } |
| 93 {% else %} |
87 {{generate_argument(method, argument, world_suffix) | indent}} | 94 {{generate_argument(method, argument, world_suffix) | indent}} |
| 95 {% endif %} |
88 {% endfor %} | 96 {% endfor %} |
89 } | 97 } |
90 {% endmacro %} | 98 {% endmacro %} |
91 | 99 |
92 | 100 |
93 {######################################} | 101 {######################################} |
94 {% macro generate_argument_var_declaration(argument) %} | 102 {% macro generate_argument_var_declaration(argument) %} |
95 {% if argument.is_callback_interface %} | 103 {% if argument.is_callback_interface %} |
96 {# FIXME: remove EventListener special case #} | 104 {# FIXME: remove EventListener special case #} |
97 {% if argument.idl_type == 'EventListener' %} | 105 {% if argument.idl_type == 'EventListener' %} |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 {% endif %} | 570 {% endif %} |
563 {{constructor.cpp_type}} impl = {{constructor.cpp_value}}; | 571 {{constructor.cpp_type}} impl = {{constructor.cpp_value}}; |
564 {% if is_constructor_raises_exception %} | 572 {% if is_constructor_raises_exception %} |
565 if (exceptionState.throwIfNeeded()) | 573 if (exceptionState.throwIfNeeded()) |
566 return; | 574 return; |
567 {% endif %} | 575 {% endif %} |
568 | 576 |
569 {{generate_constructor_wrapper(constructor) | indent}} | 577 {{generate_constructor_wrapper(constructor) | indent}} |
570 } | 578 } |
571 {% endmacro %} | 579 {% endmacro %} |
OLD | NEW |