Chromium Code Reviews| Index: Source/bindings/scripts/v8_types.py |
| diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py |
| index 5d599ab428dddef3676a84cbb6d983f34792fac0..5dab151d8bccca2a249f410b713c68fb42a19aaa 100644 |
| --- a/Source/bindings/scripts/v8_types.py |
| +++ b/Source/bindings/scripts/v8_types.py |
| @@ -211,7 +211,14 @@ def cpp_type_initializer(idl_type): |
| def cpp_type_union(idl_type, extended_attributes=None, raw_type=False): |
| - return (member_type.cpp_type for member_type in idl_type.member_types) |
| + cpp_types = [] |
|
bashi
2014/08/15 02:43:53
Use list (not set) to keep the order of members.
|
| + for member_type in idl_type.member_types: |
| + if member_type.is_string_type: |
| + cpp_types.append(member_type.cpp_type) |
| + else: |
| + cpp_types.append( |
| + cpp_template_type('Nullable', member_type.cpp_type)) |
| + return cpp_types |
| def cpp_type_initializer_union(idl_type): |
| @@ -723,14 +730,20 @@ def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, scr |
| a sequence (list or tuple) of booleans (if specified individually). |
| """ |
| - return [ |
| - member_type.v8_set_return_value(cpp_value + str(i), |
| - extended_attributes, |
| - script_wrappable, |
| - release and release[i], |
| - for_main_world) |
| - for i, member_type in |
| - enumerate(idl_type.member_types)] |
| + member_return_values = [] |
| + for index, member_type in enumerate(idl_type.member_types): |
| + if member_type.is_string_type: |
|
bashi
2014/08/15 02:43:53
or cpp_type_has_null_value?
|
| + member_cpp_value = '%s%d' % (cpp_value, index) |
| + else: |
| + member_cpp_value = '%s%d.get()' % (cpp_value, index) |
| + member_return_values.append( |
| + member_type.v8_set_return_value(member_cpp_value, |
| + extended_attributes, |
| + script_wrappable, |
| + release and release[index], |
| + for_main_world)) |
| + return member_return_values |
| + |
| IdlTypeBase.v8_set_return_value = v8_set_return_value |
| IdlUnionType.v8_set_return_value = v8_set_return_value_union |