| OLD | NEW |
| 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro generate_method(method, world_suffix) %} | 5 {% macro generate_method(method, world_suffix) %} |
| 6 {% filter conditional(method.conditional_string) %} | 6 {% filter conditional(method.conditional_string) %} |
| 7 {% if method.returns_promise and method.has_exception_state %} | 7 {% if method.returns_promise and method.has_exception_state %} |
| 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
| 9 {% else %} | 9 {% else %} |
| 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 {{generate_argument_var_declaration(argument)}}; | 76 {{generate_argument_var_declaration(argument)}}; |
| 77 {% endfor %} | 77 {% endfor %} |
| 78 { | 78 { |
| 79 {% for argument in method.arguments %} | 79 {% for argument in method.arguments %} |
| 80 {% if argument.set_default_value %} | 80 {% if argument.set_default_value %} |
| 81 if (!info[{{argument.index}}]->IsUndefined()) { | 81 if (!info[{{argument.index}}]->IsUndefined()) { |
| 82 {{generate_argument(method, argument, world_suffix) | indent(8)}} | 82 {{generate_argument(method, argument, world_suffix) | indent(8)}} |
| 83 } else { | 83 } else { |
| 84 {{argument.set_default_value}}; | 84 {{argument.set_default_value}}; |
| 85 } | 85 } |
| 86 {% elif argument.is_undefined_to_null %} |
| 87 if (!isUndefinedOrNull(info[{{argument.index}}])) { |
| 88 {{generate_argument(method, argument, world_suffix) | indent(8)}} |
| 89 } |
| 86 {% else %} | 90 {% else %} |
| 87 {{generate_argument(method, argument, world_suffix) | indent}} | 91 {{generate_argument(method, argument, world_suffix) | indent}} |
| 88 {% endif %} | 92 {% endif %} |
| 89 {% endfor %} | 93 {% endfor %} |
| 90 } | 94 } |
| 91 {% endmacro %} | 95 {% endmacro %} |
| 92 | 96 |
| 93 | 97 |
| 94 {######################################} | 98 {######################################} |
| 95 {% macro generate_argument_var_declaration(argument) %} | 99 {% macro generate_argument_var_declaration(argument) %} |
| 96 {# FIXME: remove EventListener special case #} | 100 {# FIXME: remove EventListener special case #} |
| 97 {% if argument.idl_type == 'EventListener' %} | 101 {% if argument.idl_type == 'EventListener' %} |
| 98 RefPtr<{{argument.idl_type}}> {{argument.name}} | 102 RefPtr<{{argument.idl_type}}> {{argument.name}} |
| 103 {% elif argument.is_undefined_to_null %} |
| 104 {{argument.cpp_type}}* {{argument.name}} = nullptr; |
| 105 {{argument.cpp_type}} {{argument.name}}Value |
| 99 {%- else %} | 106 {%- else %} |
| 100 {{argument.cpp_type}} {{argument.name}} | 107 {{argument.cpp_type}} {{argument.name}} |
| 101 {%- endif %}{# argument.idl_type == 'EventListener' #} | 108 {%- endif %}{# argument.idl_type == 'EventListener' #} |
| 102 {% endmacro %} | 109 {% endmacro %} |
| 103 | 110 |
| 104 | 111 |
| 105 {######################################} | 112 {######################################} |
| 106 {% macro generate_argument(method, argument, world_suffix) %} | 113 {% macro generate_argument(method, argument, world_suffix) %} |
| 107 {% if argument.is_optional and not argument.has_default and | 114 {% if argument.is_optional and not argument.has_default and |
| 108 not argument.is_dictionary and | 115 not argument.is_dictionary and |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 if method.overloads else | 698 if method.overloads else |
| 692 method.runtime_enabled_function) %} | 699 method.runtime_enabled_function) %} |
| 693 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(iso
late, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undef
ined(), defaultSignature, {{method.number_of_required_arguments}}); | 700 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(iso
late, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undef
ined(), defaultSignature, {{method.number_of_required_arguments}}); |
| 694 v8::Local<v8::Function> function = ->GetFunction(isolate->GetCurrentContext())).
ToLocalChecked(); | 701 v8::Local<v8::Function> function = ->GetFunction(isolate->GetCurrentContext())).
ToLocalChecked(); |
| 695 v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(
isolate, "{{method.name}}"), function)); | 702 v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(
isolate, "{{method.name}}"), function)); |
| 696 {% endfilter %}{# runtime_enabled() #} | 703 {% endfilter %}{# runtime_enabled() #} |
| 697 {% endfilter %}{# exposed() #} | 704 {% endfilter %}{# exposed() #} |
| 698 {% endfor %} | 705 {% endfor %} |
| 699 {% endif %} | 706 {% endif %} |
| 700 {%- endmacro %} | 707 {%- endmacro %} |
| OLD | NEW |