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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 {% endif %} | 335 {% endif %} |
336 {# First resolve by length #} | 336 {# First resolve by length #} |
337 {# 2. Initialize argcount to be min(maxarg, n). #} | 337 {# 2. Initialize argcount to be min(maxarg, n). #} |
338 switch (std::min({{overloads.maxarg}}, info.Length())) { | 338 switch (std::min({{overloads.maxarg}}, info.Length())) { |
339 {# 3. Remove from S all entries whose type list is not of length argcount. #
} | 339 {# 3. Remove from S all entries whose type list is not of length argcount. #
} |
340 {% for length, tests_methods in overloads.length_tests_methods %} | 340 {% for length, tests_methods in overloads.length_tests_methods %} |
341 case {{length}}: | 341 case {{length}}: |
342 {# Then resolve by testing argument #} | 342 {# Then resolve by testing argument #} |
343 {% for test, method in tests_methods %} | 343 {% for test, method in tests_methods %} |
344 {# 10. If i = d, then: #} | 344 {# 10. If i = d, then: #} |
| 345 {% filter runtime_enabled(method.overload_runtime_enabled_function) %} |
345 if ({{test}}) { | 346 if ({{test}}) { |
346 {% if method.measure_as and not overloads.measure_all_as %} | 347 {% if method.measure_as and not overloads.measure_all_as %} |
347 UseCounter::count(callingExecutionContext(isolate), UseCounter::{{me
thod.measure_as}}); | 348 UseCounter::count(callingExecutionContext(isolate), UseCounter::{{me
thod.measure_as}}); |
348 {% endif %} | 349 {% endif %} |
349 {% if method.deprecate_as and not overloads.deprecate_all_as %} | 350 {% if method.deprecate_as and not overloads.deprecate_all_as %} |
350 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCo
unter::{{method.deprecate_as}}); | 351 UseCounter::countDeprecation(callingExecutionContext(isolate), UseCo
unter::{{method.deprecate_as}}); |
351 {% endif %} | 352 {% endif %} |
352 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; | 353 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info)
; |
353 return; | 354 return; |
354 } | 355 } |
| 356 {% endfilter %} |
355 {% endfor %} | 357 {% endfor %} |
356 break; | 358 break; |
357 {% endfor %} | 359 {% endfor %} |
358 default: | 360 default: |
359 {# Invalid arity, throw error #} | 361 {# Invalid arity, throw error #} |
360 {# Report full list of valid arities if gaps and above minimum #} | 362 {# Report full list of valid arities if gaps and above minimum #} |
361 {% if overloads.valid_arities %} | 363 {% if overloads.valid_arities %} |
362 if (info.Length() >= {{overloads.minarg}}) { | 364 if (info.Length() >= {{overloads.minarg}}) { |
363 throwArityTypeError(exceptionState, "{{overloads.valid_arities}}", i
nfo.Length()); | 365 throwArityTypeError(exceptionState, "{{overloads.valid_arities}}", i
nfo.Length()); |
364 return; | 366 return; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 {% endif %} | 546 {% endif %} |
545 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); | 547 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); |
546 {% if is_constructor_raises_exception %} | 548 {% if is_constructor_raises_exception %} |
547 if (exceptionState.throwIfNeeded()) | 549 if (exceptionState.throwIfNeeded()) |
548 return; | 550 return; |
549 {% endif %} | 551 {% endif %} |
550 | 552 |
551 {{generate_constructor_wrapper(constructor) | indent}} | 553 {{generate_constructor_wrapper(constructor) | indent}} |
552 } | 554 } |
553 {% endmacro %} | 555 {% endmacro %} |
OLD | NEW |