OLD | NEW |
1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} |
2 | 2 |
3 {##############################################################################} | 3 {##############################################################################} |
4 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
6 {%- if attribute.is_data_type_property %} | 6 {%- if attribute.is_data_type_property %} |
7 const v8::PropertyCallbackInfo<v8::Value>& info | 7 const v8::PropertyCallbackInfo<v8::Value>& info |
8 {%- else %} | 8 {%- else %} |
9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
10 {%- endif %}) { | 10 {%- endif %}) { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s
uffix}}(v8Value, info); | 416 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s
uffix}}(v8Value, info); |
417 {% endif %} | 417 {% endif %} |
418 } | 418 } |
419 {% endmacro %} | 419 {% endmacro %} |
420 | 420 |
421 | 421 |
422 {##############################################################################} | 422 {##############################################################################} |
423 {% macro attribute_configuration(attribute) %} | 423 {% macro attribute_configuration(attribute) %} |
424 {% from 'utilities.cpp.tmpl' import property_location %} | 424 {% from 'utilities.cpp.tmpl' import property_location %} |
425 {% if attribute.constructor_type %} | 425 {% if attribute.constructor_type %} |
426 {% set getter_callback = | 426 {% if attribute.needs_constructor_getter_callback %} |
427 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr
ibute.name) | 427 {% set getter_callback = |
428 if attribute.needs_constructor_getter_callback else | 428 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial,
attribute.name) %} |
429 'v8ConstructorAttributeGetter' %} | 429 {% else %} |
| 430 {% set getter_callback = |
| 431 'V8%s::NamedConstructorAttributeGetter' % (attribute.constructor_type
) |
| 432 if attribute.is_named_constructor else 'v8ConstructorAttributeGetter'
%} |
| 433 {% endif %} |
430 {% set setter_callback = '0' %} | 434 {% set setter_callback = '0' %} |
431 {% else %}{# regular attributes #} | 435 {% else %}{# regular attributes #} |
432 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 436 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
433 (cpp_class_or_partial, attribute.name) %} | 437 (cpp_class_or_partial, attribute.name) %} |
434 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % | 438 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % |
435 (cpp_class_or_partial, attribute.name) | 439 (cpp_class_or_partial, attribute.name) |
436 if attribute.has_setter else '0' %} | 440 if attribute.has_setter else '0' %} |
437 {% endif %} | 441 {% endif %} |
438 {% set getter_callback_for_main_world = | 442 {% set getter_callback_for_main_world = |
439 '%sForMainWorld' % getter_callback | 443 '%sForMainWorld' % getter_callback |
440 if attribute.is_per_world_bindings else '0' %} | 444 if attribute.is_per_world_bindings else '0' %} |
441 {% set setter_callback_for_main_world = | 445 {% set setter_callback_for_main_world = |
442 '%sForMainWorld' % setter_callback | 446 '%sForMainWorld' % setter_callback |
443 if attribute.is_per_world_bindings and attribute.has_setter else '0' %} | 447 if attribute.is_per_world_bindings and attribute.has_setter else '0' %} |
444 {% set wrapper_type_info = | 448 {% set wrapper_type_info = |
445 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % | 449 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % |
446 attribute.constructor_type | 450 attribute.constructor_type |
447 if attribute.constructor_type else '0' %} | 451 if attribute.constructor_type and not attribute.is_named_constructor else
'0' %} |
448 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 452 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
449 ' | '.join(attribute.property_attributes) %} | 453 ' | '.join(attribute.property_attributes) %} |
450 {% set cached_accessor_callback = | 454 {% set cached_accessor_callback = |
451 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu
te.name) | 455 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu
te.name) |
452 if attribute.is_cached_accessor else | 456 if attribute.is_cached_accessor else |
453 'nullptr' %} | 457 'nullptr' %} |
454 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 458 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' |
455 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 459 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} |
456 {% set attribute_configuration_list = [ | 460 {% set attribute_configuration_list = [ |
457 '"%s"' % attribute.name, | 461 '"%s"' % attribute.name, |
458 getter_callback, | 462 getter_callback, |
459 setter_callback, | 463 setter_callback, |
460 getter_callback_for_main_world, | 464 getter_callback_for_main_world, |
461 setter_callback_for_main_world, | 465 setter_callback_for_main_world, |
462 cached_accessor_callback, | 466 cached_accessor_callback, |
463 wrapper_type_info, | 467 wrapper_type_info, |
464 property_attribute, | 468 property_attribute, |
465 property_location(attribute), | 469 property_location(attribute), |
466 holder_check, | 470 holder_check, |
467 ] %} | 471 ] %} |
468 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 472 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
469 {%- endmacro %} | 473 {%- endmacro %} |
OLD | NEW |