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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 not constant['runtime_enabled_function'] | 288 not constant['runtime_enabled_function'] |
289 for constant in constants), | 289 for constant in constants), |
290 'runtime_enabled_constants': runtime_enabled_constants, | 290 'runtime_enabled_constants': runtime_enabled_constants, |
291 'special_getter_constants': special_getter_constants, | 291 'special_getter_constants': special_getter_constants, |
292 }) | 292 }) |
293 | 293 |
294 # Attributes | 294 # Attributes |
295 attributes = [v8_attributes.attribute_context(interface, attribute) | 295 attributes = [v8_attributes.attribute_context(interface, attribute) |
296 for attribute in interface.attributes] | 296 for attribute in interface.attributes] |
297 | 297 |
298 has_conditional_attributes = any(attribute['per_context_enabled_function'] o
r attribute['exposed_test'] for attribute in attributes) | 298 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) |
299 if has_conditional_attributes and interface.is_partial: | 299 if has_conditional_attributes and interface.is_partial: |
300 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) | 300 raise Exception('Conditional attributes between partial interfaces in mo
dules and the original interfaces(%s) in core are not allowed.' % interface.name
) |
301 | 301 |
302 context.update({ | 302 context.update({ |
303 'attributes': attributes, | 303 'attributes': attributes, |
304 'has_accessor_configuration': any( | 304 'has_accessor_configuration': any( |
305 attribute['is_expose_js_accessors'] and | 305 attribute['is_expose_js_accessors'] and |
306 not (attribute['is_static'] or | 306 not (attribute['is_static'] or |
307 attribute['runtime_enabled_function'] or | 307 attribute['runtime_enabled_function']) and |
308 attribute['per_context_enabled_function']) and | |
309 attribute['should_be_exposed_to_script'] | 308 attribute['should_be_exposed_to_script'] |
310 for attribute in attributes), | 309 for attribute in attributes), |
311 'has_attribute_configuration': any( | 310 'has_attribute_configuration': any( |
312 not (attribute['is_expose_js_accessors'] or | 311 not (attribute['is_expose_js_accessors'] or |
313 attribute['is_static'] or | 312 attribute['is_static'] or |
314 attribute['runtime_enabled_function'] or | 313 attribute['runtime_enabled_function']) |
315 attribute['per_context_enabled_function']) | |
316 and attribute['should_be_exposed_to_script'] | 314 and attribute['should_be_exposed_to_script'] |
317 for attribute in attributes), | 315 for attribute in attributes), |
318 'has_conditional_attributes': has_conditional_attributes, | 316 'has_conditional_attributes': has_conditional_attributes, |
319 'has_constructor_attributes': any(attribute['constructor_type'] for attr
ibute in attributes), | 317 'has_constructor_attributes': any(attribute['constructor_type'] for attr
ibute in attributes), |
320 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), | 318 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), |
321 }) | 319 }) |
322 | 320 |
323 # Methods | 321 # Methods |
324 methods = [] | 322 methods = [] |
325 if interface.original_interface: | 323 if interface.original_interface: |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if 'overload_index' in method and 'overloads' not in method: | 517 if 'overload_index' in method and 'overloads' not in method: |
520 continue | 518 continue |
521 | 519 |
522 if 'overloads' in method: | 520 if 'overloads' in method: |
523 overloads = method['overloads'] | 521 overloads = method['overloads'] |
524 if not overloads['visible']: | 522 if not overloads['visible']: |
525 continue | 523 continue |
526 # original interface will register instead of partial interface. | 524 # original interface will register instead of partial interface. |
527 if overloads['has_partial_overloads'] and interface.is_partial: | 525 if overloads['has_partial_overloads'] and interface.is_partial: |
528 continue | 526 continue |
529 per_context_enabled_function = overloads['per_context_enabled_functi
on_all'] | |
530 conditionally_exposed_function = overloads['exposed_test_all'] | 527 conditionally_exposed_function = overloads['exposed_test_all'] |
531 runtime_enabled_function = overloads['runtime_enabled_function_all'] | 528 runtime_enabled_function = overloads['runtime_enabled_function_all'] |
532 has_custom_registration = (overloads['has_custom_registration_all']
or | 529 has_custom_registration = (overloads['has_custom_registration_all']
or |
533 overloads['runtime_determined_lengths']) | 530 overloads['runtime_determined_lengths']) |
534 else: | 531 else: |
535 if not method['visible']: | 532 if not method['visible']: |
536 continue | 533 continue |
537 per_context_enabled_function = method['per_context_enabled_function'
] | |
538 conditionally_exposed_function = method['exposed_test'] | 534 conditionally_exposed_function = method['exposed_test'] |
539 runtime_enabled_function = method['runtime_enabled_function'] | 535 runtime_enabled_function = method['runtime_enabled_function'] |
540 has_custom_registration = method['has_custom_registration'] | 536 has_custom_registration = method['has_custom_registration'] |
541 | 537 |
542 if has_custom_registration: | 538 if has_custom_registration: |
543 custom_registration_methods.append(method) | 539 custom_registration_methods.append(method) |
544 continue | 540 continue |
545 if per_context_enabled_function or conditionally_exposed_function: | 541 if conditionally_exposed_function: |
546 conditionally_enabled_methods.append(method) | 542 conditionally_enabled_methods.append(method) |
547 continue | 543 continue |
548 if runtime_enabled_function: | 544 if runtime_enabled_function: |
549 custom_registration_methods.append(method) | 545 custom_registration_methods.append(method) |
550 continue | 546 continue |
551 if method['should_be_exposed_to_script']: | 547 if method['should_be_exposed_to_script']: |
552 method_configuration_methods.append(method) | 548 method_configuration_methods.append(method) |
553 | 549 |
554 for method in methods: | 550 for method in methods: |
555 # The value of the Function object’s “length” property is a Number | 551 # 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... |
733 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] | 729 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] |
734 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] | 730 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] |
735 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), | 731 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), |
736 'length': length, | 732 'length': length, |
737 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), | 733 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), |
738 # 1. Let maxarg be the length of the longest type list of the | 734 # 1. Let maxarg be the length of the longest type list of the |
739 # entries in S. | 735 # entries in S. |
740 'maxarg': lengths[-1], | 736 'maxarg': lengths[-1], |
741 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] | 737 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] |
742 'minarg': lengths[0], | 738 'minarg': lengths[0], |
743 'per_context_enabled_function_all': common_value(overloads, 'per_context
_enabled_function'), # [PerContextEnabled] | |
744 'returns_promise_all': promise_overload_count > 0, | 739 'returns_promise_all': promise_overload_count > 0, |
745 'runtime_determined_lengths': runtime_determined_lengths, | 740 'runtime_determined_lengths': runtime_determined_lengths, |
746 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] | 741 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] |
747 'valid_arities': lengths | 742 'valid_arities': lengths |
748 # Only need to report valid arities if there is a gap in the | 743 # Only need to report valid arities if there is a gap in the |
749 # sequence of possible lengths, otherwise invalid length means | 744 # sequence of possible lengths, otherwise invalid length means |
750 # "not enough arguments". | 745 # "not enough arguments". |
751 if lengths[-1] - lengths[0] != len(lengths) - 1 else None, | 746 if lengths[-1] - lengths[0] != len(lengths) - 1 else None, |
752 'visible': has_overload_visible, | 747 'visible': has_overload_visible, |
753 'has_partial_overloads': has_partial_overloads, | 748 'has_partial_overloads': has_partial_overloads, |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1334 |
1340 extended_attributes = deleter.extended_attributes | 1335 extended_attributes = deleter.extended_attributes |
1341 idl_type = deleter.idl_type | 1336 idl_type = deleter.idl_type |
1342 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1337 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
1343 return { | 1338 return { |
1344 'is_call_with_script_state': is_call_with_script_state, | 1339 'is_call_with_script_state': is_call_with_script_state, |
1345 'is_custom': 'Custom' in extended_attributes, | 1340 'is_custom': 'Custom' in extended_attributes, |
1346 'is_raises_exception': 'RaisesException' in extended_attributes, | 1341 'is_raises_exception': 'RaisesException' in extended_attributes, |
1347 'name': cpp_name(deleter), | 1342 'name': cpp_name(deleter), |
1348 } | 1343 } |
OLD | NEW |