OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import v8_utilities | 5 import v8_utilities |
6 | 6 |
7 | 7 |
8 UNION_H_INCLUDES = frozenset([ | 8 UNION_H_INCLUDES = frozenset([ |
| 9 'bindings/core/v8/Dictionary.h', |
9 'bindings/core/v8/ExceptionState.h', | 10 'bindings/core/v8/ExceptionState.h', |
10 'bindings/core/v8/V8Binding.h', | 11 'bindings/core/v8/V8Binding.h', |
11 'platform/heap/Handle.h', | 12 'platform/heap/Handle.h', |
12 ]) | 13 ]) |
13 | 14 |
14 cpp_includes = set() | 15 cpp_includes = set() |
15 header_forward_decls = set() | 16 header_forward_decls = set() |
16 | 17 |
17 | 18 |
18 def union_context(union_types, interfaces_info): | 19 def union_context(union_types, interfaces_info): |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 context = member_context(member, interfaces_info) | 62 context = member_context(member, interfaces_info) |
62 members.append(context) | 63 members.append(context) |
63 if member.base_type == 'ArrayBuffer': | 64 if member.base_type == 'ArrayBuffer': |
64 if array_buffer_type: | 65 if array_buffer_type: |
65 raise Exception('%s is ambiguous.' % union_type.name) | 66 raise Exception('%s is ambiguous.' % union_type.name) |
66 array_buffer_type = context | 67 array_buffer_type = context |
67 elif member.base_type == 'ArrayBufferView': | 68 elif member.base_type == 'ArrayBufferView': |
68 if array_buffer_view_type: | 69 if array_buffer_view_type: |
69 raise Exception('%s is ambiguous.' % union_type.name) | 70 raise Exception('%s is ambiguous.' % union_type.name) |
70 array_buffer_view_type = context | 71 array_buffer_view_type = context |
71 elif member.is_interface_type: | 72 # FIXME: Remove generic Dictionary special casing. |
72 interface_types.append(context) | 73 elif member.is_dictionary or member.base_type == 'Dictionary': |
73 elif member.is_dictionary: | |
74 if dictionary_type: | 74 if dictionary_type: |
75 raise Exception('%s is ambiguous.' % union_type.name) | 75 raise Exception('%s is ambiguous.' % union_type.name) |
76 dictionary_type = context | 76 dictionary_type = context |
| 77 elif member.is_interface_type: |
| 78 interface_types.append(context) |
77 elif member is union_type.boolean_member_type: | 79 elif member is union_type.boolean_member_type: |
78 boolean_type = context | 80 boolean_type = context |
79 elif member is union_type.numeric_member_type: | 81 elif member is union_type.numeric_member_type: |
80 numeric_type = context | 82 numeric_type = context |
81 elif member is union_type.string_member_type: | 83 elif member is union_type.string_member_type: |
82 string_type = context | 84 string_type = context |
83 else: | 85 else: |
84 raise Exception('%s is not supported as an union member.' % member.n
ame) | 86 raise Exception('%s is not supported as an union member.' % member.n
ame) |
85 | 87 |
86 # Nullable restriction checks | 88 # Nullable restriction checks |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 'cpp_type': member.cpp_type_args(used_in_cpp_sequence=True), | 120 'cpp_type': member.cpp_type_args(used_in_cpp_sequence=True), |
119 'cpp_local_type': member.cpp_type, | 121 'cpp_local_type': member.cpp_type, |
120 'cpp_value_to_v8_value': member.cpp_value_to_v8_value( | 122 'cpp_value_to_v8_value': member.cpp_value_to_v8_value( |
121 cpp_value='impl.getAs%s()' % member.name, isolate='isolate', | 123 cpp_value='impl.getAs%s()' % member.name, isolate='isolate', |
122 creation_context='creationContext'), | 124 creation_context='creationContext'), |
123 'is_traceable': member.is_traceable, | 125 'is_traceable': member.is_traceable, |
124 'rvalue_cpp_type': member.cpp_type_args(used_as_rvalue_type=True), | 126 'rvalue_cpp_type': member.cpp_type_args(used_as_rvalue_type=True), |
125 'specific_type_enum': 'SpecificType' + member.name, | 127 'specific_type_enum': 'SpecificType' + member.name, |
126 'type_name': member.name, | 128 'type_name': member.name, |
127 'v8_value_to_local_cpp_value': member.v8_value_to_local_cpp_value( | 129 'v8_value_to_local_cpp_value': member.v8_value_to_local_cpp_value( |
128 {}, 'v8Value', 'cppValue', needs_exception_state_for_string=True), | 130 {}, 'v8Value', 'cppValue', isolate='isolate', |
| 131 needs_exception_state_for_string=True), |
129 } | 132 } |
OLD | NEW |