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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 if (attribute.is_static or | 521 if (attribute.is_static or |
522 'Unforgeable' in attribute.extended_attributes or | 522 'Unforgeable' in attribute.extended_attributes or |
523 'OverrideBuiltins' in interface.extended_attributes): | 523 'OverrideBuiltins' in interface.extended_attributes): |
524 return False | 524 return False |
525 | 525 |
526 # FIXME: We should move all of the following DOM attributes to prototype | 526 # FIXME: We should move all of the following DOM attributes to prototype |
527 # chains. | 527 # chains. |
528 if (is_constructor_attribute(attribute) or | 528 if (is_constructor_attribute(attribute) or |
529 has_custom_getter(attribute) or | 529 has_custom_getter(attribute) or |
530 has_custom_setter(attribute) or | 530 has_custom_setter(attribute) or |
531 interface.name == 'Window' or | 531 interface.name == 'Window'): |
532 v8_utilities.indexed_property_getter(interface) or | |
533 v8_utilities.indexed_property_setter(interface) or | |
534 v8_utilities.indexed_property_deleter(interface) or | |
535 v8_utilities.named_property_getter(interface) or | |
536 v8_utilities.named_property_setter(interface) or | |
537 v8_utilities.named_property_deleter(interface)): | |
538 return False | 532 return False |
539 | 533 |
540 return is_accessor | 534 return is_accessor |
541 | 535 |
542 | 536 |
543 ################################################################################ | 537 ################################################################################ |
544 # Constructors | 538 # Constructors |
545 ################################################################################ | 539 ################################################################################ |
546 | 540 |
547 idl_types.IdlType.constructor_type_name = property( | 541 idl_types.IdlType.constructor_type_name = property( |
548 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 542 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
549 lambda self: strip_suffix(self.base_type, 'Constructor')) | 543 lambda self: strip_suffix(self.base_type, 'Constructor')) |
550 | 544 |
551 | 545 |
552 def is_constructor_attribute(attribute): | 546 def is_constructor_attribute(attribute): |
553 # FIXME: replace this with [ConstructorAttribute] extended attribute | 547 # FIXME: replace this with [ConstructorAttribute] extended attribute |
554 return attribute.idl_type.name.endswith('Constructor') | 548 return attribute.idl_type.name.endswith('Constructor') |
555 | 549 |
556 | 550 |
557 def update_constructor_attribute_context(interface, attribute, context): | 551 def update_constructor_attribute_context(interface, attribute, context): |
558 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 552 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
559 # When the attribute name is the same as the interface name, do not generate | 553 # When the attribute name is the same as the interface name, do not generate |
560 # callback functions for each attribute and use | 554 # callback functions for each attribute and use |
561 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 555 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
562 # a callback function in order to hard-code the attribute name. | 556 # a callback function in order to hard-code the attribute name. |
563 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 557 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
OLD | NEW |