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

Unified Diff: Source/bindings/scripts/v8_interface.py

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/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index 549818a6cdb89e24b158e84caedeb534906ecc9e..7256bb814d1b61ca6003d5c8e6937fd664addb17 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -934,7 +934,7 @@ def interface_length(interface, constructors):
def property_getter(getter, cpp_arguments):
def is_null_expression(idl_type):
if idl_type.is_union_type:
- return ' && '.join('!result%sEnabled' % i
+ return ' && '.join('result%s.isNull()' % i
for i, _ in enumerate(idl_type.member_types))
if idl_type.name == 'String':
return 'result.isNull()'
@@ -957,6 +957,8 @@ def property_getter(getter, cpp_arguments):
cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
+ cpp_return_value = 'result' if not idl_type.is_union_type else 'result{index}.get()'
+
return {
'cpp_type': idl_type.cpp_type,
'cpp_value': cpp_value,
@@ -973,7 +975,7 @@ def property_getter(getter, cpp_arguments):
'is_raises_exception': is_raises_exception,
'name': cpp_name(getter),
'union_arguments': union_arguments,
- 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_attributes=extended_attributes, script_wrappable='impl', release=idl_type.release),
+ 'v8_set_return_value': idl_type.v8_set_return_value(cpp_return_value, extended_attributes=extended_attributes, script_wrappable='impl', release=idl_type.release),
}

Powered by Google App Engine
This is Rietveld 408576698