| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {# FIXME: We should return a rejected Promise if an error occurs in this | 2 {# FIXME: We should return a rejected Promise if an error occurs in this |
| 3 function when ALL methods in this overload return Promise. In order to do so, | 3 function when ALL methods in this overload return Promise. In order to do so, |
| 4 we must ensure either ALL or NO methods in this overload return Promise #} | 4 we must ensure either ALL or NO methods in this overload return Promise #} |
| 5 {% macro overload_resolution_method(method) %} | 5 {% macro overload_resolution_method(method) %} |
| 6 {% set overloads = method.overloads %} | 6 {% set overloads = method.overloads %} |
| 7 {% if method.is_static %} | 7 {% if method.is_static %} |
| 8 {% set offset = 0 %} | 8 {% set offset = 0 %} |
| 9 {% else %} | 9 {% else %} |
| 10 {% set offset = 1 %} | 10 {% set offset = 1 %} |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 exception = ToDart("Failed to fetch domWindow"); | 328 exception = ToDart("Failed to fetch domWindow"); |
| 329 goto fail; | 329 goto fail; |
| 330 } | 330 } |
| 331 Document& document = *domWindow->document(); | 331 Document& document = *domWindow->document(); |
| 332 {% endif %} | 332 {% endif %} |
| 333 int argCount /* FIXME(vsm): Remove this. */ ALLOW_UNUSED = Dart_GetNativ
eArgumentCount(args); | 333 int argCount /* FIXME(vsm): Remove this. */ ALLOW_UNUSED = Dart_GetNativ
eArgumentCount(args); |
| 334 {% if constructor.has_exception_state %} | 334 {% if constructor.has_exception_state %} |
| 335 ExceptionState es; | 335 ExceptionState es; |
| 336 {% endif %} | 336 {% endif %} |
| 337 {{generate_arguments(constructor) | indent(8)}} | 337 {{generate_arguments(constructor) | indent(8)}} |
| 338 {{callback_return(constructor, constructor.dart_set_return_value, constr
uctor.cpp_value) | indent(8)}} | 338 {{constructor.cpp_value}}->AssociateWithDartWrapper(args); |
| 339 {% if constructor.has_exception_state %} | 339 {% if constructor.has_exception_state %} |
| 340 if (es.had_exception()) { | 340 if (es.had_exception()) { |
| 341 exception = es.GetDartException(args, {{constructor.auto_scope}}); | 341 exception = es.GetDartException(args, {{constructor.auto_scope}}); |
| 342 goto fail; | 342 goto fail; |
| 343 } | 343 } |
| 344 | 344 |
| 345 {% endif %} | 345 {% endif %} |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 361 { | 361 { |
| 362 Dart_SetReturnValue(args, Dart_Null()); | 362 Dart_SetReturnValue(args, Dart_Null()); |
| 363 } | 363 } |
| 364 {% endmacro %} | 364 {% endmacro %} |
| 365 | 365 |
| 366 , | 366 , |
| 367 {##############################################################################} | 367 {##############################################################################} |
| 368 {% macro generate_resolver_constructor(dart_class, class_name, constructor) %} | 368 {% macro generate_resolver_constructor(dart_class, class_name, constructor) %} |
| 369 {% for native_entry in constructor.native_entries %} | 369 {% for native_entry in constructor.native_entries %} |
| 370 {% set resolver_string = native_entry.resolver_string %} | 370 {% set resolver_string = native_entry.resolver_string %} |
| 371 {% set args_one_based = constructor.number_of_arguments + 1 %} |
| 372 {% set args_required_one_based = constructor.number_of_required_arguments + 1 %} |
| 371 {% if constructor.overload_index %} | 373 {% if constructor.overload_index %} |
| 372 {% set constructor_name = static_method_name(constructor.name) + "Dispatcher"
%} | 374 {% set constructor_name = static_method_name(constructor.name) + "Dispatcher"
%} |
| 373 {% else %} | 375 {% else %} |
| 374 {% set constructor_name = static_method_name(constructor.name) %} | 376 {% set constructor_name = static_method_name(constructor.name) %} |
| 375 {% endif %} | 377 {% endif %} |
| 376 {% if has_custom_constructor %} | 378 {% if has_custom_constructor %} |
| 377 if (name == "{{resolver_string}}") { | 379 if (name == "{{resolver_string}}") { |
| 378 {% elif constructor.number_of_arguments == constructor.number_of_required_argume
nts %} | 380 {% elif constructor.number_of_arguments == constructor.number_of_required_argume
nts %} |
| 379 if (argumentCount == {{constructor.number_of_arguments}} && name == "{{resolver_
string}}") { | 381 if (argumentCount == {{args_one_based}} && name == "{{resolver_string}}") { |
| 380 {% else %} | 382 {% else %} |
| 381 if (argumentCount >= {{constructor.number_of_required_arguments}} && argumentCou
nt <= {{constructor.number_of_arguments}} && name == "{{resolver_string}}") { | 383 if (argumentCount >= {{args_required_one_based}} && argumentCount <= {{args_one_
based}} && name == "{{resolver_string}}") { |
| 382 {% endif %} | 384 {% endif %} |
| 383 *autoSetupScope = {{constructor.auto_scope}}; | 385 *autoSetupScope = {{constructor.auto_scope}}; |
| 384 return {{dart_class}}Internal::{{constructor_name}}; | 386 return {{dart_class}}Internal::{{constructor_name}}; |
| 385 } | 387 } |
| 386 {% endfor %} | 388 {% endfor %} |
| 387 {% endmacro %} | 389 {% endmacro %} |
| 388 | 390 |
| 389 {##############################################################################} | 391 {##############################################################################} |
| 390 {% macro generate_resolver_event_constructor(dart_class, class_name) %} | 392 {% macro generate_resolver_event_constructor(dart_class, class_name) %} |
| 391 {% set resolver_string = interface_name + "_constructorCallback" %} | 393 {% set resolver_string = interface_name + "_constructorCallback" %} |
| 392 if (argumentCount == 2 && name == "{{resolver_string}}") { | 394 if (argumentCount == 2 && name == "{{resolver_string}}") { |
| 393 *autoSetupScope = 1; | 395 *autoSetupScope = 1; |
| 394 return {{dart_class}}Internal::eventConstructorCallback; | 396 return {{dart_class}}Internal::eventConstructorCallback; |
| 395 } | 397 } |
| 396 {% endmacro %} | 398 {% endmacro %} |
| 397 | 399 |
| 398 {##############################################################################} | 400 {##############################################################################} |
| 399 {% macro generate_symbolizer_constructor(dart_class, class_name, constructor) %} | 401 {% macro generate_symbolizer_constructor(dart_class, class_name, constructor) %} |
| 400 {% for native_entry in constructor.native_entries %} | 402 {% for native_entry in constructor.native_entries %} |
| 401 {% set resolver_string = native_entry.resolver_string %} | 403 {% set resolver_string = native_entry.resolver_string %} |
| 402 if (native_function == {{dart_class}}Internal::{{static_method_name(constructor.
name, constructor.overload_index)}}) { | 404 if (native_function == {{dart_class}}Internal::{{static_method_name(constructor.
name, constructor.overload_index)}}) { |
| 403 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); | 405 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); |
| 404 } | 406 } |
| 405 {% endfor %} | 407 {% endfor %} |
| 406 {% endmacro %} | 408 {% endmacro %} |
| OLD | NEW |