OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # coding=utf-8 | 2 # coding=utf-8 |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 overload_extended_attributes = [ | 674 overload_extended_attributes = [ |
675 method['custom_registration_extended_attributes'] | 675 method['custom_registration_extended_attributes'] |
676 for method in overloads] | 676 for method in overloads] |
677 for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIB
UTES: | 677 for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIB
UTES: |
678 if common_key(overload_extended_attributes, extended_attribute) is N
one: | 678 if common_key(overload_extended_attributes, extended_attribute) is N
one: |
679 raise ValueError('Overloads of %s have conflicting extended attr
ibute %s' | 679 raise ValueError('Overloads of %s have conflicting extended attr
ibute %s' |
680 % (name, extended_attribute)) | 680 % (name, extended_attribute)) |
681 | 681 |
682 # Check and fail if overloads disagree about whether the return type | 682 # Check and fail if overloads disagree about whether the return type |
683 # is a Promise or not. | 683 # is a Promise or not. |
684 promise_overload_count = sum(1 for method in overloads if method.get('idl_ty
pe') == 'Promise') | 684 promise_overload_count = sum(1 for method in overloads if method.get('return
s_promise')) |
685 if promise_overload_count not in (0, len(overloads)): | 685 if promise_overload_count not in (0, len(overloads)): |
686 raise ValueError('Overloads of %s have conflicting Promise/non-Promise t
ypes' | 686 raise ValueError('Overloads of %s have conflicting Promise/non-Promise t
ypes' |
687 % (name)) | 687 % (name)) |
688 | 688 |
689 has_overload_visible = False | 689 has_overload_visible = False |
690 has_overload_not_visible = False | 690 has_overload_not_visible = False |
691 for overload in overloads: | 691 for overload in overloads: |
692 if overload.get('visible', True): | 692 if overload.get('visible', True): |
693 # If there exists an overload which is visible, need to generate | 693 # If there exists an overload which is visible, need to generate |
694 # overload_resolution, i.e. overlods_visible should be True. | 694 # overload_resolution, i.e. overlods_visible should be True. |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 'has_type_checking_interface': | 1283 'has_type_checking_interface': |
1284 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface'
) or | 1284 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface'
) or |
1285 has_extended_attribute_value(setter, 'TypeChecking', 'Interface'))
and | 1285 has_extended_attribute_value(setter, 'TypeChecking', 'Interface'))
and |
1286 idl_type.is_wrapper_type, | 1286 idl_type.is_wrapper_type, |
1287 'idl_type': idl_type.base_type, | 1287 'idl_type': idl_type.base_type, |
1288 'is_custom': 'Custom' in extended_attributes, | 1288 'is_custom': 'Custom' in extended_attributes, |
1289 'is_nullable': idl_type.is_nullable, | 1289 'is_nullable': idl_type.is_nullable, |
1290 'is_raises_exception': is_raises_exception, | 1290 'is_raises_exception': is_raises_exception, |
1291 'name': cpp_name(setter), | 1291 'name': cpp_name(setter), |
1292 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( | 1292 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
1293 extended_attributes, 'v8Value', 'propertyValue', restricted_float), | 1293 extended_attributes, 'v8Value', 'propertyValue', restricted_float=re
stricted_float), |
1294 } | 1294 } |
1295 | 1295 |
1296 | 1296 |
1297 def property_deleter(deleter): | 1297 def property_deleter(deleter): |
1298 if not deleter: | 1298 if not deleter: |
1299 return None | 1299 return None |
1300 | 1300 |
1301 idl_type = deleter.idl_type | 1301 idl_type = deleter.idl_type |
1302 if str(idl_type) != 'boolean': | 1302 if str(idl_type) != 'boolean': |
1303 raise Exception( | 1303 raise Exception( |
1304 'Only deleters with boolean type are allowed, but type is "%s"' % | 1304 'Only deleters with boolean type are allowed, but type is "%s"' % |
1305 idl_type) | 1305 idl_type) |
1306 extended_attributes = deleter.extended_attributes | 1306 extended_attributes = deleter.extended_attributes |
1307 return { | 1307 return { |
1308 'is_custom': 'Custom' in extended_attributes, | 1308 'is_custom': 'Custom' in extended_attributes, |
1309 'is_raises_exception': 'RaisesException' in extended_attributes, | 1309 'is_raises_exception': 'RaisesException' in extended_attributes, |
1310 'name': cpp_name(deleter), | 1310 'name': cpp_name(deleter), |
1311 } | 1311 } |
OLD | NEW |