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

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: 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
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index 71336908ed341d74bd1d874fd74ebef9069038cb..194780f409f9e4de4c88e33aadb39c801d4432e6 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.is_use_result_local and not method.union_arguments %}
haraken 2014/07/10 14:43:57 Can we fix the code generator so that we always us
Jens Widell 2014/07/10 14:56:44 I had that for a while. The generated code ends up
haraken 2014/07/10 15:11:44 I think we should investigate. Since you're taking
Jens Widell 2014/07/10 15:28:53 Very quick investigation (I just hacked my use_loc
{{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',

Powered by Google App Engine
This is Rietveld 408576698