Chromium Code Reviews| Index: Source/bindings/scripts/v8_union.py |
| diff --git a/Source/bindings/scripts/v8_union.py b/Source/bindings/scripts/v8_union.py |
| index f0b696a582f9f34b85250b88ef02d80618b9e558..52b8e1f4a5fbd388c9730e5fdb4980bc7aa69257 100644 |
| --- a/Source/bindings/scripts/v8_union.py |
| +++ b/Source/bindings/scripts/v8_union.py |
| @@ -70,6 +70,7 @@ def container_context(union_type, interfaces_info): |
| array_or_sequence_type = None |
| boolean_type = None |
| dictionary_type = None |
| + enum_type = None |
| interface_types = [] |
| numeric_type = None |
| string_type = None |
| @@ -95,11 +96,17 @@ def container_context(union_type, interfaces_info): |
| array_or_sequence_type = context |
| elif member.is_interface_type: |
| interface_types.append(context) |
| + elif member.is_enum: |
|
Jens Widell
2015/01/16 09:53:51
If there's an enum type in the union, it will be u
bashi
2015/01/16 10:11:58
My understanding is that enums and strings are not
|
| + if string_type: |
| + raise Exception('%s is ambiguous.' % union_type.name) |
| + enum_type = context |
| elif member is union_type.boolean_member_type: |
| boolean_type = context |
| elif member is union_type.numeric_member_type: |
| numeric_type = context |
| elif member is union_type.string_member_type: |
| + if enum_type: |
| + raise Exception('%s is ambiguious.' % union_type.name) |
| string_type = context |
| else: |
| raise Exception('%s is not supported as an union member.' % member.name) |
| @@ -118,13 +125,14 @@ def container_context(union_type, interfaces_info): |
| 'boolean_type': boolean_type, |
| 'cpp_class': union_type.cpp_type, |
| 'dictionary_type': dictionary_type, |
| - 'type_string': str(union_type), |
| + 'enum_type': enum_type, |
| 'includes_nullable_type': union_type.includes_nullable_type, |
| 'interface_types': interface_types, |
| 'members': members, |
| 'needs_trace': any(member['is_traceable'] for member in members), |
| 'numeric_type': numeric_type, |
| 'string_type': string_type, |
| + 'type_string': str(union_type), |
| } |
| @@ -143,6 +151,7 @@ def member_context(member, interfaces_info): |
| 'cpp_value_to_v8_value': member.cpp_value_to_v8_value( |
| cpp_value='impl.getAs%s()' % member.name, isolate='isolate', |
| creation_context='creationContext'), |
| + 'enum_validation_expression': member.enum_validation_expression, |
| 'is_traceable': member.is_traceable, |
| 'rvalue_cpp_type': member.cpp_type_args(used_as_rvalue_type=True), |
| 'specific_type_enum': 'SpecificType' + member.name, |