OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 134 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
135 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 135 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
136 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings] | 136 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings] |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 def generate_argument(interface, method, argument, index): | 140 def generate_argument(interface, method, argument, index): |
141 extended_attributes = argument.extended_attributes | 141 extended_attributes = argument.extended_attributes |
142 idl_type = argument.idl_type | 142 idl_type = argument.idl_type |
143 this_cpp_value = cpp_value(interface, method, index) | 143 this_cpp_value = cpp_value(interface, method, index) |
| 144 has_type_checking_unrestricted = ( |
| 145 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or |
| 146 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) a
nd |
| 147 idl_type.name in ('Float', 'Double')) |
| 148 if has_type_checking_unrestricted: |
| 149 includes.add('wtf/dtoa/double.h') |
144 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 150 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
| 151 |
145 return { | 152 return { |
146 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrap
per_type), | 153 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrap
per_type), |
147 'cpp_value': this_cpp_value, | 154 'cpp_value': this_cpp_value, |
148 'enum_validation_expression': idl_type.enum_validation_expression, | 155 'enum_validation_expression': idl_type.enum_validation_expression, |
149 'has_default': 'Default' in extended_attributes, | 156 'has_default': 'Default' in extended_attributes, |
150 'has_event_listener_argument': any( | 157 'has_event_listener_argument': any( |
151 argument_so_far for argument_so_far in method.arguments[:index] | 158 argument_so_far for argument_so_far in method.arguments[:index] |
152 if argument_so_far.idl_type.name == 'EventListener'), | 159 if argument_so_far.idl_type.name == 'EventListener'), |
153 'has_legacy_overload_string': # [LegacyOverloadString] | 160 'has_legacy_overload_string': # [LegacyOverloadString] |
154 'LegacyOverloadString' in extended_attributes, | 161 'LegacyOverloadString' in extended_attributes, |
155 'has_type_checking_interface': | 162 'has_type_checking_interface': |
156 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface'
) or | 163 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface'
) or |
157 has_extended_attribute_value(method, 'TypeChecking', 'Interface'))
and | 164 has_extended_attribute_value(method, 'TypeChecking', 'Interface'))
and |
158 idl_type.is_wrapper_type, | 165 idl_type.is_wrapper_type, |
| 166 'has_type_checking_unrestricted': has_type_checking_unrestricted, |
159 # Dictionary is special-cased, but arrays and sequences shouldn't be | 167 # Dictionary is special-cased, but arrays and sequences shouldn't be |
160 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, | 168 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, |
161 'idl_type_object': idl_type, | 169 'idl_type_object': idl_type, |
162 'index': index, | 170 'index': index, |
163 'is_clamp': 'Clamp' in extended_attributes, | 171 'is_clamp': 'Clamp' in extended_attributes, |
164 'is_callback_interface': idl_type.is_callback_interface, | 172 'is_callback_interface': idl_type.is_callback_interface, |
165 'is_nullable': idl_type.is_nullable, | 173 'is_nullable': idl_type.is_nullable, |
166 'is_optional': argument.is_optional, | 174 'is_optional': argument.is_optional, |
167 'is_variadic_wrapper_type': is_variadic_wrapper_type, | 175 'is_variadic_wrapper_type': is_variadic_wrapper_type, |
168 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc
_type), | 176 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc
_type), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 285 |
278 | 286 |
279 def union_arguments(idl_type): | 287 def union_arguments(idl_type): |
280 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 288 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
281 return [arg | 289 return [arg |
282 for i in range(len(idl_type.member_types)) | 290 for i in range(len(idl_type.member_types)) |
283 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 291 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
284 | 292 |
285 IdlType.union_arguments = property(lambda self: None) | 293 IdlType.union_arguments = property(lambda self: None) |
286 IdlUnionType.union_arguments = property(union_arguments) | 294 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |