| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 {% macro type_error_message(method, error_message) %} | 319 {% macro type_error_message(method, error_message) %} |
| 320 {% if method.is_constructor %} | 320 {% if method.is_constructor %} |
| 321 ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}}) | 321 ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}}) |
| 322 {%- else %} | 322 {%- else %} |
| 323 ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{er
ror_message}}) | 323 ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{er
ror_message}}) |
| 324 {%- endif %} | 324 {%- endif %} |
| 325 {%- endmacro %} | 325 {%- endmacro %} |
| 326 | 326 |
| 327 | 327 |
| 328 {######################################} | 328 {######################################} |
| 329 {% macro throw_from_exception_state(method) %} | 329 {% macro throw_from_exception_state(method_or_overloads) %} |
| 330 {% if method.idl_type == 'Promise' %} | 330 {% if method_or_overloads.idl_type == 'Promise' or method_or_overloads.returns_p
romise_all %} |
| 331 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolat
e())).v8Value()) | 331 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolat
e())).v8Value()) |
| 332 {%- else %} | 332 {%- else %} |
| 333 exceptionState.throwIfNeeded() | 333 exceptionState.throwIfNeeded() |
| 334 {%- endif %} | 334 {%- endif %} |
| 335 {%- endmacro %} | 335 {%- endmacro %} |
| 336 | 336 |
| 337 | 337 |
| 338 {######################################} | 338 {######################################} |
| 339 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %} | 339 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %} |
| 340 {% if method.has_exception_state %} | 340 {% if method.has_exception_state %} |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 default: | 403 default: |
| 404 {# If methods are overloaded between interface and partial interface #} | 404 {# If methods are overloaded between interface and partial interface #} |
| 405 {# definitions, need to invoke methods defined in the partial #} | 405 {# definitions, need to invoke methods defined in the partial #} |
| 406 {# interface. #} | 406 {# interface. #} |
| 407 {# FIXME: we do not need to always generate this code. #} | 407 {# FIXME: we do not need to always generate this code. #} |
| 408 {# Invalid arity, throw error #} | 408 {# Invalid arity, throw error #} |
| 409 {# Report full list of valid arities if gaps and above minimum #} | 409 {# Report full list of valid arities if gaps and above minimum #} |
| 410 {% if overloads.valid_arities %} | 410 {% if overloads.valid_arities %} |
| 411 if (info.Length() >= {{overloads.minarg}}) { | 411 if (info.Length() >= {{overloads.minarg}}) { |
| 412 setArityTypeError(exceptionState, "{{overloads.valid_arities}}", inf
o.Length()); | 412 setArityTypeError(exceptionState, "{{overloads.valid_arities}}", inf
o.Length()); |
| 413 exceptionState.throwIfNeeded(); | 413 {{throw_from_exception_state(overloads)}}; |
| 414 return; | 414 return; |
| 415 } | 415 } |
| 416 {% endif %} | 416 {% endif %} |
| 417 {# Otherwise just report "not enough arguments" #} | 417 {# Otherwise just report "not enough arguments" #} |
| 418 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{ov
erloads.minarg}}, info.Length())); | 418 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{ov
erloads.minarg}}, info.Length())); |
| 419 exceptionState.throwIfNeeded(); | 419 {{throw_from_exception_state(overloads)}}; |
| 420 return; | 420 return; |
| 421 {% endif %} | 421 {% endif %} |
| 422 } | 422 } |
| 423 {% if not is_partial and overloads.has_partial_overloads %} | 423 {% if not is_partial and overloads.has_partial_overloads %} |
| 424 ASSERT({{overloads.name}}MethodForPartialInterface); | 424 ASSERT({{overloads.name}}MethodForPartialInterface); |
| 425 ({{overloads.name}}MethodForPartialInterface)(info); | 425 ({{overloads.name}}MethodForPartialInterface)(info); |
| 426 {% else %} | 426 {% else %} |
| 427 {# No match, throw error #} | 427 {# No match, throw error #} |
| 428 exceptionState.throwTypeError("No function was found that matched the signat
ure provided."); | 428 exceptionState.throwTypeError("No function was found that matched the signat
ure provided."); |
| 429 exceptionState.throwIfNeeded(); | 429 {{throw_from_exception_state(overloads)}}; |
| 430 {% endif %} | 430 {% endif %} |
| 431 } | 431 } |
| 432 {% endmacro %} | 432 {% endmacro %} |
| 433 | 433 |
| 434 | 434 |
| 435 {##############################################################################} | 435 {##############################################################################} |
| 436 {% macro method_callback(method, world_suffix) %} | 436 {% macro method_callback(method, world_suffix) %} |
| 437 {% filter conditional(method.conditional_string) %} | 437 {% filter conditional(method.conditional_string) %} |
| 438 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) | 438 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 439 { | 439 { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 {% for method in conditionally_enabled_methods %} | 656 {% for method in conditionally_enabled_methods %} |
| 657 {% filter per_context_enabled(method.per_context_enabled_function) %} | 657 {% filter per_context_enabled(method.per_context_enabled_function) %} |
| 658 {% filter exposed(method.exposed_test) %} | 658 {% filter exposed(method.exposed_test) %} |
| 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()); | 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()); |
| 660 {% endfilter %} | 660 {% endfilter %} |
| 661 {% endfilter %} | 661 {% endfilter %} |
| 662 {% endfor %} | 662 {% endfor %} |
| 663 {% endif %} | 663 {% endif %} |
| 664 } | 664 } |
| 665 {%- endmacro %} | 665 {%- endmacro %} |
| OLD | NEW |