| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 'reflect_missing': extended_attributes.get('ReflectMissing'), | 134 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 135 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), | 135 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), |
| 136 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] | 136 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] |
| 137 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), | 137 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), |
| 138 'world_suffixes': ['', 'ForMainWorld'] | 138 'world_suffixes': ['', 'ForMainWorld'] |
| 139 if 'PerWorldBindings' in extended_attributes | 139 if 'PerWorldBindings' in extended_attributes |
| 140 else [''], # [PerWorldBindings] | 140 else [''], # [PerWorldBindings] |
| 141 } | 141 } |
| 142 | 142 |
| 143 if is_constructor_attribute(attribute): | 143 if is_constructor_attribute(attribute): |
| 144 constructor_getter_context(interface, attribute, context) | 144 update_constructor_attribute_context(interface, attribute, context) |
| 145 if not has_custom_getter(attribute): | 145 if not has_custom_getter(attribute): |
| 146 getter_context(interface, attribute, context) | 146 getter_context(interface, attribute, context) |
| 147 if not has_custom_setter(attribute) and has_setter(attribute): | 147 if not has_custom_setter(attribute) and has_setter(attribute): |
| 148 setter_context(interface, attribute, context) | 148 setter_context(interface, attribute, context) |
| 149 | 149 |
| 150 return context | 150 return context |
| 151 | 151 |
| 152 | 152 |
| 153 ################################################################################ | 153 ################################################################################ |
| 154 # Getter | 154 # Getter |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 idl_types.IdlType.constructor_type_name = property( | 510 idl_types.IdlType.constructor_type_name = property( |
| 511 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 511 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
| 512 lambda self: strip_suffix(self.base_type, 'Constructor')) | 512 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 513 | 513 |
| 514 | 514 |
| 515 def is_constructor_attribute(attribute): | 515 def is_constructor_attribute(attribute): |
| 516 # FIXME: replace this with [ConstructorAttribute] extended attribute | 516 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 517 return attribute.idl_type.name.endswith('Constructor') | 517 return attribute.idl_type.name.endswith('Constructor') |
| 518 | 518 |
| 519 | 519 |
| 520 def constructor_getter_context(interface, attribute, context): | 520 def update_constructor_attribute_context(interface, attribute, context): |
| 521 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 521 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| 522 # When the attribute name is the same as the interface name, do not generate |
| 523 # callback functions for each attribute and use |
| 524 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
| 525 # a callback function in order to hard-code the attribute name. |
| 526 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
| OLD | NEW |