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_methods.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_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index 9c1f7c3f6db106426a22089c65db923fc68f063d..2e314626fa9e4ada22421acfb57acaf255ac261f 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -344,6 +344,8 @@ def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False)
if idl_type.is_explicit_nullable:
# result is of type Nullable<T>
cpp_value = 'result.get()'
+ elif idl_type.is_union_type:
+ cpp_value = 'result{index}.get()'
else:
cpp_value = 'result'
release = idl_type.release
@@ -401,10 +403,9 @@ def property_attributes(method):
def union_arguments(idl_type):
- """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for union types, for use in setting return value"""
- return [arg
- for i in range(len(idl_type.member_types))
- for arg in ['result%sEnabled' % i, 'result%s' % i]]
+ """Return list of ['result0', 'result1', ...] for union types, for use in setting return value"""
+ return ['result%d' % i
+ for i in range(len(idl_type.member_types))]
def argument_default_cpp_value(argument):

Powered by Google App Engine
This is Rietveld 408576698