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

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

Issue 466323002: IDL: Use Nullable for union type return value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 cf307e68859e6f8a5be32b7564636cd4045ddcad..714e5a6b53cc80b8e054a2b3bbc6edb231d293e5 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -296,18 +296,17 @@ if (info.Length() >= 2 && listener && !impl->toNode())
{######################################}
{% macro union_type_method_call_and_set_return_value(method) %}
-{% for cpp_type in method.cpp_type %}
-bool result{{loop.index0}}Enabled = false;
-{{cpp_type}} result{{loop.index0}};
+{% for argument in method.union_arguments %}
+{{argument.cpp_type}} {{argument.cpp_value}};
{% endfor %}
{{method.cpp_value}};
{% if method.is_null_expression %}{# used by getters #}
if ({{method.is_null_expression}})
return;
{% endif %}
-{% for v8_set_return_value in method.v8_set_return_value %}
-if (result{{loop.index0}}Enabled) {
- {{v8_set_return_value}};
+{% for argument in method.union_arguments %}
+if ({{argument.null_check_value}}) {
+ {{argument.v8_set_return_value}};
return;
}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698