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

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

Issue 385603002: IDL: Support using nullable on any method return type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use_result_local => use_local_result Created 6 years, 5 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/scripts/v8_types.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index 71336908ed341d74bd1d874fd74ebef9069038cb..4ce408a59b5aa344e0e771e271ffad433a7c281d 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -252,8 +252,7 @@ if (!{{method.cpp_value}})
return;
{% elif method.is_constructor %}
{{method.cpp_type}} impl = {{cpp_value}};
-{% elif method.is_call_with_script_state or method.is_raises_exception %}
-{# FIXME: consider always using a local variable #}
+{% elif method.use_local_result and not method.union_arguments %}
{{method.cpp_type}} result = {{cpp_value}};
{% endif %}
{# Post-call #}
@@ -269,7 +268,14 @@ if (exceptionState.hadException()) {
{%- elif method.union_arguments %}
{{union_type_method_call_and_set_return_value(method)}}
{%- elif v8_set_return_value %}
+{% if method.is_nullable %}
+if (result.isNull())
+ v8SetReturnValueNull(info);
+else
+ {{v8_set_return_value}};
+{% else %}
{{v8_set_return_value}};
+{% endif %}
{%- endif %}{# None for void #}
{# Post-set #}
{% if interface_name == 'EventTarget' and method.name in ('addEventListener',
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698