OLD | NEW |
1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} | 1 {% from 'conversions.cpp' import v8_value_to_local_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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 {% elif argument.is_dictionary %} | 171 {% elif argument.is_dictionary %} |
172 {% if not argument.use_permissive_dictionary_conversion %} | 172 {% if not argument.use_permissive_dictionary_conversion %} |
173 {# Dictionaries must have type Undefined, Null or Object: | 173 {# Dictionaries must have type Undefined, Null or Object: |
174 http://heycam.github.io/webidl/#es-dictionary #} | 174 http://heycam.github.io/webidl/#es-dictionary #} |
175 if (!isUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->I
sObject()) { | 175 if (!isUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->I
sObject()) { |
176 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' % | 176 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' % |
177 (argument.index + 1, argument.name)) | indent}} | 177 (argument.index + 1, argument.name)) | indent}} |
178 } | 178 } |
179 {% endif %}{# not argument.use_permissive_dictionary_conversion #} | 179 {% endif %}{# not argument.use_permissive_dictionary_conversion #} |
180 {{v8_value_to_local_cpp_value(argument)}} | 180 {{v8_value_to_local_cpp_value(argument)}} |
| 181 {% elif argument.is_explicit_nullable %} |
| 182 if (!isUndefinedOrNull(info[{{argument.index}}])) { |
| 183 {{v8_value_to_local_cpp_value(argument) | indent}} |
| 184 } |
181 {% else %}{# argument.is_nullable #} | 185 {% else %}{# argument.is_nullable #} |
182 {{v8_value_to_local_cpp_value(argument)}} | 186 {{v8_value_to_local_cpp_value(argument)}} |
183 {% endif %}{# argument.is_nullable #} | 187 {% endif %}{# argument.is_nullable #} |
184 {# Type checking, possibly throw a TypeError, per: | 188 {# Type checking, possibly throw a TypeError, per: |
185 http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 189 http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
186 {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_
type %} | 190 {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_
type %} |
187 {# Type checking for wrapper interface types (if interface not implemented, | 191 {# Type checking for wrapper interface types (if interface not implemented, |
188 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface | 192 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface |
189 Note: for variadic arguments, the type checking is done for each matched | 193 Note: for variadic arguments, the type checking is done for each matched |
190 argument instead; see argument.is_variadic_wrapper_type code-path above. #} | 194 argument instead; see argument.is_variadic_wrapper_type code-path above. #} |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if method.overloads else | 661 if method.overloads else |
658 method.runtime_enabled_function) %} | 662 method.runtime_enabled_function) %} |
659 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio
nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho
dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument
s}})->GetFunction()); | 663 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio
nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho
dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument
s}})->GetFunction()); |
660 {% endfilter %}{# runtime_enabled() #} | 664 {% endfilter %}{# runtime_enabled() #} |
661 {% endfilter %}{# exposed() #} | 665 {% endfilter %}{# exposed() #} |
662 {% endfilter %}{# per_context_enabled() #} | 666 {% endfilter %}{# per_context_enabled() #} |
663 {% endfor %} | 667 {% endfor %} |
664 {% endif %} | 668 {% endif %} |
665 } | 669 } |
666 {%- endmacro %} | 670 {%- endmacro %} |
OLD | NEW |