| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 not constant['runtime_enabled_function'] | 278 not constant['runtime_enabled_function'] |
| 279 for constant in constants), | 279 for constant in constants), |
| 280 'runtime_enabled_constants': runtime_enabled_constants, | 280 'runtime_enabled_constants': runtime_enabled_constants, |
| 281 'special_getter_constants': special_getter_constants, | 281 'special_getter_constants': special_getter_constants, |
| 282 }) | 282 }) |
| 283 | 283 |
| 284 # Attributes | 284 # Attributes |
| 285 attributes = [v8_attributes.attribute_context(interface, attribute) | 285 attributes = [v8_attributes.attribute_context(interface, attribute) |
| 286 for attribute in interface.attributes] | 286 for attribute in interface.attributes] |
| 287 | 287 |
| 288 has_conditional_attributes = any(attribute['per_context_enabled_function'] o
r attribute['exposed_test'] for attribute in attributes) | 288 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) |
| 289 if has_conditional_attributes and interface.is_partial: | 289 if has_conditional_attributes and interface.is_partial: |
| 290 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) | 290 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) |
| 291 | 291 |
| 292 context.update({ | 292 context.update({ |
| 293 'attributes': attributes, | 293 'attributes': attributes, |
| 294 'has_accessor_configuration': any( | 294 'has_accessor_configuration': any( |
| 295 attribute['is_expose_js_accessors'] and | 295 attribute['is_expose_js_accessors'] and |
| 296 not (attribute['is_static'] or | 296 not (attribute['is_static'] or |
| 297 attribute['runtime_enabled_function'] or | 297 attribute['runtime_enabled_function']) and |
| 298 attribute['per_context_enabled_function']) and | |
| 299 attribute['should_be_exposed_to_script'] | 298 attribute['should_be_exposed_to_script'] |
| 300 for attribute in attributes), | 299 for attribute in attributes), |
| 301 'has_attribute_configuration': any( | 300 'has_attribute_configuration': any( |
| 302 not (attribute['is_expose_js_accessors'] or | 301 not (attribute['is_expose_js_accessors'] or |
| 303 attribute['is_static'] or | 302 attribute['is_static'] or |
| 304 attribute['runtime_enabled_function'] or | 303 attribute['runtime_enabled_function']) |
| 305 attribute['per_context_enabled_function']) | |
| 306 and attribute['should_be_exposed_to_script'] | 304 and attribute['should_be_exposed_to_script'] |
| 307 for attribute in attributes), | 305 for attribute in attributes), |
| 308 'has_conditional_attributes': has_conditional_attributes, | 306 'has_conditional_attributes': has_conditional_attributes, |
| 309 'has_constructor_attributes': any(attribute['constructor_type'] for attr
ibute in attributes), | 307 'has_constructor_attributes': any(attribute['constructor_type'] for attr
ibute in attributes), |
| 310 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), | 308 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), |
| 311 }) | 309 }) |
| 312 | 310 |
| 313 # Methods | 311 # Methods |
| 314 methods = [] | 312 methods = [] |
| 315 if interface.original_interface: | 313 if interface.original_interface: |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 if 'overload_index' in method and 'overloads' not in method: | 507 if 'overload_index' in method and 'overloads' not in method: |
| 510 continue | 508 continue |
| 511 | 509 |
| 512 if 'overloads' in method: | 510 if 'overloads' in method: |
| 513 overloads = method['overloads'] | 511 overloads = method['overloads'] |
| 514 if not overloads['visible']: | 512 if not overloads['visible']: |
| 515 continue | 513 continue |
| 516 # original interface will register instead of partial interface. | 514 # original interface will register instead of partial interface. |
| 517 if overloads['has_partial_overloads'] and interface.is_partial: | 515 if overloads['has_partial_overloads'] and interface.is_partial: |
| 518 continue | 516 continue |
| 519 per_context_enabled_function = overloads['per_context_enabled_functi
on_all'] | |
| 520 conditionally_exposed_function = overloads['exposed_test_all'] | 517 conditionally_exposed_function = overloads['exposed_test_all'] |
| 521 runtime_enabled_function = overloads['runtime_enabled_function_all'] | 518 runtime_enabled_function = overloads['runtime_enabled_function_all'] |
| 522 has_custom_registration = (overloads['has_custom_registration_all']
or | 519 has_custom_registration = (overloads['has_custom_registration_all']
or |
| 523 overloads['runtime_determined_lengths']) | 520 overloads['runtime_determined_lengths']) |
| 524 else: | 521 else: |
| 525 if not method['visible']: | 522 if not method['visible']: |
| 526 continue | 523 continue |
| 527 per_context_enabled_function = method['per_context_enabled_function'
] | |
| 528 conditionally_exposed_function = method['exposed_test'] | 524 conditionally_exposed_function = method['exposed_test'] |
| 529 runtime_enabled_function = method['runtime_enabled_function'] | 525 runtime_enabled_function = method['runtime_enabled_function'] |
| 530 has_custom_registration = method['has_custom_registration'] | 526 has_custom_registration = method['has_custom_registration'] |
| 531 | 527 |
| 532 if has_custom_registration: | 528 if has_custom_registration: |
| 533 custom_registration_methods.append(method) | 529 custom_registration_methods.append(method) |
| 534 continue | 530 continue |
| 535 if per_context_enabled_function or conditionally_exposed_function: | 531 if conditionally_exposed_function: |
| 536 conditionally_enabled_methods.append(method) | 532 conditionally_enabled_methods.append(method) |
| 537 continue | 533 continue |
| 538 if runtime_enabled_function: | 534 if runtime_enabled_function: |
| 539 custom_registration_methods.append(method) | 535 custom_registration_methods.append(method) |
| 540 continue | 536 continue |
| 541 if method['should_be_exposed_to_script']: | 537 if method['should_be_exposed_to_script']: |
| 542 method_configuration_methods.append(method) | 538 method_configuration_methods.append(method) |
| 543 | 539 |
| 544 for method in methods: | 540 for method in methods: |
| 545 # The value of the Function object’s “length” property is a Number | 541 # The value of the Function object’s “length” property is a Number |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] | 719 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] |
| 724 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] | 720 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] |
| 725 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), | 721 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), |
| 726 'length': length, | 722 'length': length, |
| 727 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), | 723 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), |
| 728 # 1. Let maxarg be the length of the longest type list of the | 724 # 1. Let maxarg be the length of the longest type list of the |
| 729 # entries in S. | 725 # entries in S. |
| 730 'maxarg': lengths[-1], | 726 'maxarg': lengths[-1], |
| 731 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] | 727 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] |
| 732 'minarg': lengths[0], | 728 'minarg': lengths[0], |
| 733 'per_context_enabled_function_all': common_value(overloads, 'per_context
_enabled_function'), # [PerContextEnabled] | |
| 734 'returns_promise_all': promise_overload_count > 0, | 729 'returns_promise_all': promise_overload_count > 0, |
| 735 'runtime_determined_lengths': runtime_determined_lengths, | 730 'runtime_determined_lengths': runtime_determined_lengths, |
| 736 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] | 731 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] |
| 737 'valid_arities': lengths | 732 'valid_arities': lengths |
| 738 # Only need to report valid arities if there is a gap in the | 733 # Only need to report valid arities if there is a gap in the |
| 739 # sequence of possible lengths, otherwise invalid length means | 734 # sequence of possible lengths, otherwise invalid length means |
| 740 # "not enough arguments". | 735 # "not enough arguments". |
| 741 if lengths[-1] - lengths[0] != len(lengths) - 1 else None, | 736 if lengths[-1] - lengths[0] != len(lengths) - 1 else None, |
| 742 'visible': has_overload_visible, | 737 'visible': has_overload_visible, |
| 743 'has_partial_overloads': has_partial_overloads, | 738 'has_partial_overloads': has_partial_overloads, |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 | 1324 |
| 1330 extended_attributes = deleter.extended_attributes | 1325 extended_attributes = deleter.extended_attributes |
| 1331 idl_type = deleter.idl_type | 1326 idl_type = deleter.idl_type |
| 1332 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1327 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
| 1333 return { | 1328 return { |
| 1334 'is_call_with_script_state': is_call_with_script_state, | 1329 'is_call_with_script_state': is_call_with_script_state, |
| 1335 'is_custom': 'Custom' in extended_attributes, | 1330 'is_custom': 'Custom' in extended_attributes, |
| 1336 'is_raises_exception': 'RaisesException' in extended_attributes, | 1331 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1337 'name': cpp_name(deleter), | 1332 'name': cpp_name(deleter), |
| 1338 } | 1333 } |
| OLD | NEW |