| 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 29 matching lines...) Expand all Loading... |
| 40 import v8_utilities | 40 import v8_utilities |
| 41 from v8_utilities import has_extended_attribute_value | 41 from v8_utilities import has_extended_attribute_value |
| 42 | 42 |
| 43 | 43 |
| 44 # Methods with any of these require custom method registration code in the | 44 # Methods with any of these require custom method registration code in the |
| 45 # interface's configure*Template() function. | 45 # interface's configure*Template() function. |
| 46 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ | 46 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ |
| 47 'DoNotCheckSecurity', | 47 'DoNotCheckSecurity', |
| 48 'DoNotCheckSignature', | 48 'DoNotCheckSignature', |
| 49 'NotEnumerable', | 49 'NotEnumerable', |
| 50 'ReadOnly', | |
| 51 'Unforgeable', | 50 'Unforgeable', |
| 52 ]) | 51 ]) |
| 53 | 52 |
| 54 | 53 |
| 55 def argument_needs_try_catch(argument): | 54 def argument_needs_try_catch(argument): |
| 56 idl_type = argument.idl_type | 55 idl_type = argument.idl_type |
| 57 base_type = not idl_type.array_or_sequence_type and idl_type.base_type | 56 base_type = not idl_type.array_or_sequence_type and idl_type.base_type |
| 58 | 57 |
| 59 return not ( | 58 return not ( |
| 60 # These cases are handled by separate code paths in the | 59 # These cases are handled by separate code paths in the |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 'is_check_security_for_frame': is_check_security_for_frame, | 136 'is_check_security_for_frame': is_check_security_for_frame, |
| 138 'is_check_security_for_node': is_check_security_for_node, | 137 'is_check_security_for_node': is_check_security_for_node, |
| 139 'is_custom': 'Custom' in extended_attributes, | 138 'is_custom': 'Custom' in extended_attributes, |
| 140 'is_custom_element_callbacks': is_custom_element_callbacks, | 139 'is_custom_element_callbacks': is_custom_element_callbacks, |
| 141 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, | 140 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, |
| 142 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute
s, | 141 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute
s, |
| 143 'is_partial_interface_member': | 142 'is_partial_interface_member': |
| 144 'PartialInterfaceImplementedAs' in extended_attributes, | 143 'PartialInterfaceImplementedAs' in extended_attributes, |
| 145 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 144 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
| 146 'is_raises_exception': is_raises_exception, | 145 'is_raises_exception': is_raises_exception, |
| 147 'is_read_only': 'ReadOnly' in extended_attributes, | 146 'is_read_only': 'Unforgeable' in extended_attributes, |
| 148 'is_static': is_static, | 147 'is_static': is_static, |
| 149 'is_variadic': arguments and arguments[-1].is_variadic, | 148 'is_variadic': arguments and arguments[-1].is_variadic, |
| 150 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] | 149 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] |
| 151 'name': name, | 150 'name': name, |
| 152 'number_of_arguments': len(arguments), | 151 'number_of_arguments': len(arguments), |
| 153 'number_of_required_arguments': len([ | 152 'number_of_required_arguments': len([ |
| 154 argument for argument in arguments | 153 argument for argument in arguments |
| 155 if not (argument.is_optional or argument.is_variadic)]), | 154 if not (argument.is_optional or argument.is_variadic)]), |
| 156 'number_of_required_or_variadic_arguments': len([ | 155 'number_of_required_or_variadic_arguments': len([ |
| 157 argument for argument in arguments | 156 argument for argument in arguments |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 ################################################################################ | 309 ################################################################################ |
| 311 # Auxiliary functions | 310 # Auxiliary functions |
| 312 ################################################################################ | 311 ################################################################################ |
| 313 | 312 |
| 314 # [NotEnumerable] | 313 # [NotEnumerable] |
| 315 def property_attributes(method): | 314 def property_attributes(method): |
| 316 extended_attributes = method.extended_attributes | 315 extended_attributes = method.extended_attributes |
| 317 property_attributes_list = [] | 316 property_attributes_list = [] |
| 318 if 'NotEnumerable' in extended_attributes: | 317 if 'NotEnumerable' in extended_attributes: |
| 319 property_attributes_list.append('v8::DontEnum') | 318 property_attributes_list.append('v8::DontEnum') |
| 320 if 'ReadOnly' in extended_attributes: | 319 if 'Unforgeable' in extended_attributes: |
| 321 property_attributes_list.append('v8::ReadOnly') | 320 property_attributes_list.append('v8::ReadOnly') |
| 322 if property_attributes_list: | 321 if property_attributes_list: |
| 323 property_attributes_list.insert(0, 'v8::DontDelete') | 322 property_attributes_list.insert(0, 'v8::DontDelete') |
| 324 return property_attributes_list | 323 return property_attributes_list |
| 325 | 324 |
| 326 | 325 |
| 327 def union_arguments(idl_type): | 326 def union_arguments(idl_type): |
| 328 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 327 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
| 329 return [arg | 328 return [arg |
| 330 for i in range(len(idl_type.member_types)) | 329 for i in range(len(idl_type.member_types)) |
| 331 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 330 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
| 332 | 331 |
| 333 | 332 |
| 334 def argument_default_cpp_value(argument): | 333 def argument_default_cpp_value(argument): |
| 335 if not argument.default_value: | 334 if not argument.default_value: |
| 336 return None | 335 return None |
| 337 return argument.idl_type.literal_cpp_value(argument.default_value) | 336 return argument.idl_type.literal_cpp_value(argument.default_value) |
| 338 | 337 |
| 339 IdlType.union_arguments = property(lambda self: None) | 338 IdlType.union_arguments = property(lambda self: None) |
| 340 IdlUnionType.union_arguments = property(union_arguments) | 339 IdlUnionType.union_arguments = property(union_arguments) |
| 341 IdlArgument.default_cpp_value = property(argument_default_cpp_value) | 340 IdlArgument.default_cpp_value = property(argument_default_cpp_value) |
| OLD | NEW |