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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 restricted_float = ( | 204 restricted_float = ( |
205 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or | 205 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or |
206 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) | 206 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) |
207 | 207 |
208 if ('ImplementedInPrivateScript' in extended_attributes and | 208 if ('ImplementedInPrivateScript' in extended_attributes and |
209 not idl_type.is_wrapper_type and | 209 not idl_type.is_wrapper_type and |
210 not idl_type.is_basic_type): | 210 not idl_type.is_basic_type): |
211 raise Exception('Private scripts supports only primitive types and DOM w rappers.') | 211 raise Exception('Private scripts supports only primitive types and DOM w rappers.') |
212 | 212 |
213 set_default_value = argument.set_default_value | 213 set_default_value = argument.set_default_value |
214 this_cpp_type = None | |
215 if idl_type.is_explicit_nullable and not argument.is_variadic: | |
Jens Widell
2015/03/02 08:42:17
This is not quite what I meant. I meant to do
t
| |
216 this_cpp_type = v8_types.cpp_template_type('Nullable', idl_type.cpp_type ) | |
217 else: | |
218 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attr ibutes, | |
219 raw_type=True, | |
220 used_as_variadic_argument=argumen t.is_variadic) | |
214 return { | 221 return { |
215 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, | 222 'cpp_type': this_cpp_type, |
216 raw_type=True, | |
217 used_as_variadic_argument=argument.is _variadic), | |
218 'cpp_value': this_cpp_value, | 223 'cpp_value': this_cpp_value, |
219 # FIXME: check that the default value's type is compatible with the argu ment's | 224 # FIXME: check that the default value's type is compatible with the argu ment's |
220 'set_default_value': set_default_value, | 225 'set_default_value': set_default_value, |
221 'enum_validation_expression': idl_type.enum_validation_expression, | 226 'enum_validation_expression': idl_type.enum_validation_expression, |
222 'handle': '%sHandle' % argument.name, | 227 'handle': '%sHandle' % argument.name, |
223 # FIXME: remove once [Default] removed and just use argument.default_val ue | 228 # FIXME: remove once [Default] removed and just use argument.default_val ue |
224 'has_default': 'Default' in extended_attributes or set_default_value, | 229 'has_default': 'Default' in extended_attributes or set_default_value, |
225 'has_type_checking_interface': type_checking_interface, | 230 'has_type_checking_interface': type_checking_interface, |
226 # Dictionary is special-cased, but arrays and sequences shouldn't be | 231 # Dictionary is special-cased, but arrays and sequences shouldn't be |
227 'idl_type': idl_type.base_type, | 232 'idl_type': idl_type.base_type, |
228 'idl_type_object': idl_type, | 233 'idl_type_object': idl_type, |
229 'index': index, | 234 'index': index, |
230 'is_callback_function': idl_type.is_callback_function, | 235 'is_callback_function': idl_type.is_callback_function, |
231 'is_callback_interface': idl_type.is_callback_interface, | 236 'is_callback_interface': idl_type.is_callback_interface, |
232 # FIXME: Remove generic 'Dictionary' special-casing | 237 # FIXME: Remove generic 'Dictionary' special-casing |
233 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary', | 238 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary', |
239 'is_explicit_nullable': idl_type.is_explicit_nullable, | |
234 'is_nullable': idl_type.is_nullable, | 240 'is_nullable': idl_type.is_nullable, |
235 'is_optional': argument.is_optional, | 241 'is_optional': argument.is_optional, |
236 'is_variadic': argument.is_variadic, | 242 'is_variadic': argument.is_variadic, |
237 'is_variadic_wrapper_type': is_variadic_wrapper_type, | 243 'is_variadic_wrapper_type': is_variadic_wrapper_type, |
238 'is_wrapper_type': idl_type.is_wrapper_type, | 244 'is_wrapper_type': idl_type.is_wrapper_type, |
239 'name': argument.name, | 245 'name': argument.name, |
240 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 246 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
241 argument.name, isolate='scriptState->isolate()', | 247 argument.name, isolate='scriptState->isolate()', |
242 creation_context='scriptState->context()->Global()'), | 248 creation_context='scriptState->context()->Global()'), |
243 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes, | 249 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 | 452 |
447 IdlOperation.returns_promise = property(method_returns_promise) | 453 IdlOperation.returns_promise = property(method_returns_promise) |
448 | 454 |
449 | 455 |
450 def argument_conversion_needs_exception_state(method, argument): | 456 def argument_conversion_needs_exception_state(method, argument): |
451 idl_type = argument.idl_type | 457 idl_type = argument.idl_type |
452 return (idl_type.v8_conversion_needs_exception_state or | 458 return (idl_type.v8_conversion_needs_exception_state or |
453 argument.is_variadic or | 459 argument.is_variadic or |
454 (method.returns_promise and (idl_type.is_string_type or | 460 (method.returns_promise and (idl_type.is_string_type or |
455 idl_type.is_enum))) | 461 idl_type.is_enum))) |
OLD | NEW |