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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 (argument.index + 1, argument.name)) | indent}} | 168 (argument.index + 1, argument.name)) | indent}} |
169 return; | 169 return; |
170 } | 170 } |
171 {% endif %}{# not argument.use_permissive_dictionary_conversion #} | 171 {% endif %}{# not argument.use_permissive_dictionary_conversion #} |
172 {{argument.v8_value_to_local_cpp_value}}; | 172 {{argument.v8_value_to_local_cpp_value}}; |
173 {% else %}{# argument.is_nullable #} | 173 {% else %}{# argument.is_nullable #} |
174 {{argument.v8_value_to_local_cpp_value}}; | 174 {{argument.v8_value_to_local_cpp_value}}; |
175 {% endif %}{# argument.is_nullable #} | 175 {% endif %}{# argument.is_nullable #} |
176 {# Type checking, possibly throw a TypeError, per: | 176 {# Type checking, possibly throw a TypeError, per: |
177 http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 177 http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
178 {% if argument.has_type_checking_unrestricted %} | 178 {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_
type %} |
179 {# Non-finite floating point values (NaN, +Infinity or −Infinity), per: | |
180 http://heycam.github.io/webidl/#es-float | |
181 http://heycam.github.io/webidl/#es-double #} | |
182 if (!std::isfinite({{argument.name}})) { | |
183 {{throw_type_error(method, '"%s parameter %s is non-finite."' % | |
184 (argument.idl_type, argument.index + 1)) | indent
}} | |
185 return; | |
186 } | |
187 {% elif argument.has_type_checking_interface and not argument.is_variadic_wrappe
r_type %} | |
188 {# Type checking for wrapper interface types (if interface not implemented, | 179 {# Type checking for wrapper interface types (if interface not implemented, |
189 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface | 180 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface |
190 Note: for variadic arguments, the type checking is done for each matched | 181 Note: for variadic arguments, the type checking is done for each matched |
191 argument instead; see argument.is_variadic_wrapper_type code-path above. #} | 182 argument instead; see argument.is_variadic_wrapper_type code-path above. #} |
192 if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{
{argument.index}}]){% endif %}) { | 183 if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{
{argument.index}}]){% endif %}) { |
193 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 184 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
194 (argument.index + 1, argument.idl_type)) | indent
}} | 185 (argument.index + 1, argument.idl_type)) | indent
}} |
195 return; | 186 return; |
196 } | 187 } |
197 {% elif argument.enum_validation_expression %} | 188 {% elif argument.enum_validation_expression %} |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 if method.overloads else | 651 if method.overloads else |
661 method.runtime_enabled_function) %} | 652 method.runtime_enabled_function) %} |
662 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()); | 653 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 {% endfilter %}{# runtime_enabled() #} | 654 {% endfilter %}{# runtime_enabled() #} |
664 {% endfilter %}{# exposed() #} | 655 {% endfilter %}{# exposed() #} |
665 {% endfilter %}{# per_context_enabled() #} | 656 {% endfilter %}{# per_context_enabled() #} |
666 {% endfor %} | 657 {% endfor %} |
667 {% endif %} | 658 {% endif %} |
668 } | 659 } |
669 {%- endmacro %} | 660 {%- endmacro %} |
OLD | NEW |