| OLD | NEW |
| (Empty) |
| 1 {######################################} | |
| 2 {% macro install_constants() %} | |
| 3 {% if has_constant_configuration %} | |
| 4 {# Normal constants #} | |
| 5 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ | |
| 6 {% for constant in constants if not constant.runtime_enabled_function %} | |
| 7 {% if constant.idl_type in ('Double', 'Float') %} | |
| 8 {% set value = '0, %s, 0' % constant.value %} | |
| 9 {% elif constant.idl_type == 'String' %} | |
| 10 {% set value = '0, 0, %s' % constant.value %} | |
| 11 {% else %} | |
| 12 {# 'Short', 'Long' etc. #} | |
| 13 {% set value = '%s, 0, 0' % constant.value %} | |
| 14 {% endif %} | |
| 15 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.
idl_type}}}, | |
| 16 {% endfor %} | |
| 17 }; | |
| 18 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, {{v8_c
lass}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants), isolate); | |
| 19 {% endif %} | |
| 20 {# Runtime-enabled constants #} | |
| 21 {% for constant in constants if constant.runtime_enabled_function %} | |
| 22 if ({{constant.runtime_enabled_function}}()) { | |
| 23 {% if constant.idl_type in ('Double', 'Float') %} | |
| 24 {% set value = '0, %s, 0' % constant.value %} | |
| 25 {% elif constant.idl_type == 'String' %} | |
| 26 {% set value = '0, 0, %s' % constant.value %} | |
| 27 {% else %} | |
| 28 {# 'Short', 'Long' etc. #} | |
| 29 {% set value = '%s, 0, 0' % constant.value %} | |
| 30 {% endif %} | |
| 31 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration
= {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.i
dl_type}}}; | |
| 32 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, &c
onstantConfiguration, 1, isolate); | |
| 33 } | |
| 34 {% endfor %} | |
| 35 {# Check constants #} | |
| 36 {% if not do_not_check_constants %} | |
| 37 {% for constant in constants %} | |
| 38 {% if constant.idl_type not in ('Double', 'Float', 'String') %} | |
| 39 {% set constant_cpp_class = constant.cpp_class or cpp_class %} | |
| 40 COMPILE_ASSERT({{constant.value}} == {{constant_cpp_class}}::{{constant.reflecte
d_name}}, TheValueOf{{cpp_class}}_{{constant.reflected_name}}DoesntMatchWithImpl
ementation); | |
| 41 {% endif %} | |
| 42 {% endfor %} | |
| 43 {% endif %} | |
| 44 {% endmacro %} | |
| OLD | NEW |