Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: Source/bindings/templates/conversions.cpp

Issue 946973005: IDL: Drop value conversion (V8 -> C++) macros from generated code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cb48705d6c57b8ea7919d39c604f3986987ec2f3
--- /dev/null
+++ b/Source/bindings/templates/conversions.cpp
@@ -0,0 +1,31 @@
+{% 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 %}
+{% 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.set_expression %}
+{{item.set_expression}};
+{% endif %}
+{% if item.check_expression %}
+if ({{item.check_expression}})
+ return{% if item.return_expression %} {{item.return_expression}}{% endif %};
+{% endif %}{# item.check_expression #}
+{% endif %}{# item.error_message #}
+{% endmacro %}
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698