Chromium Code Reviews| Index: Source/bindings/templates/conversions.cpp |
| diff --git a/Source/bindings/templates/conversions.cpp b/Source/bindings/templates/conversions.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5196c6af64e50e7a7412e4b79e261562a7893170 |
| --- /dev/null |
| +++ b/Source/bindings/templates/conversions.cpp |
| @@ -0,0 +1,37 @@ |
| +{% macro v8_value_to_local_cpp_value(thing) %} |
| +{# This indirection is just to avoid spurious white-space lines. #} |
| +{{generate_v8_value_to_local_cpp_value(thing) | trim}} |
| +{%- endmacro %} |
| + |
| + |
| +{% macro generate_v8_value_to_local_cpp_value(thing) %} |
| +{% set item = thing.v8_value_to_local_cpp_value or thing %} |
|
haraken
2015/02/24 12:44:57
I'm not sure if we want to add conversions.cpp, bu
Jens Widell
2015/02/24 13:36:07
What are the arguments against adding it?
|
| +{% if item.error_message %} |
| +/* {{item.error_message}} */ |
| +{% else %} |
| +{% if item.declare_variable %} |
| +{% if item.assign_expression %} |
| +{{item.cpp_type}} {{item.cpp_name}} = {{item.assign_expression}}; |
| +{% else %} |
| +{{item.cpp_type}} {{item.cpp_name}}; |
| +{% endif %} |
| +{% else %}{# item.declare_variable #} |
| +{% if item.assign_expression %} |
| +{{item.cpp_name}} = {{item.assign_expression}}; |
| +{% endif %} |
| +{% endif %}{# item.declare_variable #} |
| +{% if item.check_expression %} |
| +{% if item.throw_expression %} |
| +if ({{item.check_expression}}) { |
| + {{item.throw_expression}}; |
| + return{% if item.return_expression %} {{item.return_expression}}{% endif %}; |
| +} |
| +{% else %} |
| +if ({{item.check_expression}}) |
| + return{% if item.return_expression %} {{item.return_expression}}{% endif %}; |
| +{% endif %} |
| +{% endif %}{# item.check_expression #} |
| +{% endif %}{# item.error_message #} |
| +{% endmacro %} |
| + |
| + |