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

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

Issue 680193003: IDL: Generate union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index aadc5be57086e13773b483a2fc52c331ab8b9c61..46ad27b11b432b1797da01146adc5edec1fd6741 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -238,7 +238,7 @@ if (!{{method.cpp_value}})
{{cpp_value}};
{% elif method.is_constructor %}
{{method.cpp_type}} impl = {{cpp_value}};
-{% elif method.use_local_result and not method.union_arguments %}
+{% elif method.use_local_result and not method.union_result_members %}
{{method.cpp_type}} result = {{cpp_value}};
{% endif %}
{# Post-call #}
@@ -251,7 +251,7 @@ if (exceptionState.hadException()) {
{# Set return value #}
{% if method.is_constructor %}
{{generate_constructor_wrapper(method)}}
-{%- elif method.union_arguments %}
+{%- elif method.union_result_members %}
{{union_type_method_call_and_set_return_value(method)}}
{%- elif v8_set_return_value %}
{% if method.is_explicit_nullable %}
@@ -279,17 +279,15 @@ if (info.Length() >= {{argument_index}} + 1 && listener && !impl->toNode())
{######################################}
{% macro union_type_method_call_and_set_return_value(method) %}
Jens Widell 2014/10/28 11:31:38 Could the scope of this macro now be reduced to ju
bashi 2014/10/29 01:34:32 Took the later approach, and removed special code
-{% for argument in method.union_arguments %}
-{{argument.cpp_type}} {{argument.cpp_value}}{{argument.cpp_type_initializer}};
-{% endfor %}
+{{method.cpp_type}} result;
{{method.cpp_value}};
{% if method.is_null_expression %}{# used by getters #}
if ({{method.is_null_expression}})
return;
{% endif %}
-{% for argument in method.union_arguments %}
-if ({{argument.null_check_value}}) {
- {{argument.v8_set_return_value}};
+{% for member in method.union_result_members %}
+if ({{member.null_check_value}}) {
+ {{member.v8_set_return_value}};
return;
}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698