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 {% if method.number_of_required_arguments %} | 10 {% if method.number_of_required_arguments %} |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}} | 87 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}} |
88 {% endif %} | 88 {% endif %} |
89 {% if argument.has_event_listener_argument %} | 89 {% if argument.has_event_listener_argument %} |
90 {{hidden_dependency_action(method.name) | indent}} | 90 {{hidden_dependency_action(method.name) | indent}} |
91 {% endif %} | 91 {% endif %} |
92 return; | 92 return; |
93 } | 93 } |
94 {% endif %} | 94 {% endif %} |
95 {% if argument.has_type_checking_interface %} | 95 {% if argument.has_type_checking_interface %} |
96 {# Type checking for wrapper interface types (if interface not implemented, | 96 {# Type checking for wrapper interface types (if interface not implemented, |
97 throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 97 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
98 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) { | 98 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) { |
99 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 99 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
100 (argument.index + 1, argument.idl_type)) | indent }} | 100 (argument.index + 1, argument.idl_type)) | indent }} |
101 return; | 101 return; |
102 } | 102 } |
103 {% elif argument.has_type_checking_unrestricted %} | |
104 {# Type checking for non-finite floating point values (if NaN, +Infinity or | |
105 −Infinity, throw TypeError), per http://heycam.github.io/webidl/#es-float | |
106 and http://heycam.github.io/webidl/#es-double #} | |
107 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}WTF::double_conversion::Double (info[{{argument.index}}]->NumberValue()).IsSpecial()) { | |
Nils Barth (inactive)
2014/04/28 09:16:14
This would be much slicker (and faster) as:
info[{
| |
108 {{throw_type_error(method, '"%s parameter %s is non-finite."' % | |
109 (argument.idl_type, argument.index + 1)) | indent }} | |
110 return; | |
111 } | |
103 {% endif %} | 112 {% endif %} |
104 {% if argument.is_callback_interface %} | 113 {% if argument.is_callback_interface %} |
105 {# FIXME: remove EventListener special case #} | 114 {# FIXME: remove EventListener special case #} |
106 {% if argument.idl_type == 'EventListener' %} | 115 {% if argument.idl_type == 'EventListener' %} |
107 {% if method.name == 'removeEventListener' %} | 116 {% if method.name == 'removeEventListener' %} |
108 RefPtr<{{argument.idl_type}}> {{argument.name}} = V8EventListenerList::getEventL istener(info[1], false, ListenerFindOnly); | 117 RefPtr<{{argument.idl_type}}> {{argument.name}} = V8EventListenerList::getEventL istener(info[1], false, ListenerFindOnly); |
109 {% else %}{# method.name == 'addEventListener' #} | 118 {% else %}{# method.name == 'addEventListener' #} |
110 RefPtr<{{argument.idl_type}}> {{argument.name}} = V8EventListenerList::getEventL istener(info[1], false, ListenerFindOrCreate); | 119 RefPtr<{{argument.idl_type}}> {{argument.name}} = V8EventListenerList::getEventL istener(info[1], false, ListenerFindOrCreate); |
111 {% endif %}{# method.name #} | 120 {% endif %}{# method.name #} |
112 {% else %} | 121 {% else %} |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 {% endfor %} | 457 {% endfor %} |
449 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); | 458 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); |
450 {% if is_constructor_raises_exception %} | 459 {% if is_constructor_raises_exception %} |
451 if (exceptionState.throwIfNeeded()) | 460 if (exceptionState.throwIfNeeded()) |
452 return; | 461 return; |
453 {% endif %} | 462 {% endif %} |
454 | 463 |
455 {{generate_constructor_wrapper(constructor) | indent}} | 464 {{generate_constructor_wrapper(constructor) | indent}} |
456 } | 465 } |
457 {% endmacro %} | 466 {% endmacro %} |
OLD | NEW |