| 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 22 matching lines...) Expand all Loading... |
| 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler | 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler |
| 34 """ | 34 """ |
| 35 | 35 |
| 36 import idl_types | 36 import idl_types |
| 37 from idl_types import inherits_interface | 37 from idl_types import inherits_interface |
| 38 from v8_globals import includes, interfaces | 38 from v8_globals import includes, interfaces |
| 39 import v8_types | 39 import v8_types |
| 40 import v8_utilities | 40 import v8_utilities |
| 41 from v8_utilities import (cpp_name_or_partial, capitalize, cpp_name, has_extende
d_attribute, | 41 from v8_utilities import (cpp_name_or_partial, capitalize, cpp_name, has_extende
d_attribute, |
| 42 has_extended_attribute_value, scoped_name, strip_suffi
x, | 42 has_extended_attribute_value, scoped_name, strip_suffi
x, |
| 43 uncapitalize, extended_attribute_value_as_list, is_unf
orgeable) | 43 uncapitalize, extended_attribute_value_as_list, is_unf
orgeable, |
| 44 is_legacy_interface_type_checking) |
| 44 | 45 |
| 45 | 46 |
| 46 def attribute_context(interface, attribute): | 47 def attribute_context(interface, attribute): |
| 47 idl_type = attribute.idl_type | 48 idl_type = attribute.idl_type |
| 48 base_idl_type = idl_type.base_type | 49 base_idl_type = idl_type.base_type |
| 49 extended_attributes = attribute.extended_attributes | 50 extended_attributes = attribute.extended_attributes |
| 50 | 51 |
| 51 idl_type.add_includes_for_type() | 52 idl_type.add_includes_for_type() |
| 52 | 53 |
| 53 # [CheckSecurity] | 54 # [CheckSecurity] |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 context['cpp_setter'] = '%sForceSetAttributeOnThis(propertyName, v8Value
, info)' % cpp_name(interface) | 311 context['cpp_setter'] = '%sForceSetAttributeOnThis(propertyName, v8Value
, info)' % cpp_name(interface) |
| 311 return | 312 return |
| 312 | 313 |
| 313 extended_attributes = attribute.extended_attributes | 314 extended_attributes = attribute.extended_attributes |
| 314 idl_type = attribute.idl_type | 315 idl_type = attribute.idl_type |
| 315 | 316 |
| 316 # [RaisesException], [RaisesException=Setter] | 317 # [RaisesException], [RaisesException=Setter] |
| 317 is_setter_raises_exception = ( | 318 is_setter_raises_exception = ( |
| 318 'RaisesException' in extended_attributes and | 319 'RaisesException' in extended_attributes and |
| 319 extended_attributes['RaisesException'] in [None, 'Setter']) | 320 extended_attributes['RaisesException'] in [None, 'Setter']) |
| 320 # [TypeChecking=Interface] | 321 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] |
| 321 has_type_checking_interface = ( | 322 has_type_checking_interface = ( |
| 322 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or | 323 not is_legacy_interface_type_checking(interface, attribute) and |
| 323 has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) a
nd | |
| 324 idl_type.is_wrapper_type) | 324 idl_type.is_wrapper_type) |
| 325 | 325 |
| 326 context.update({ | 326 context.update({ |
| 327 'has_setter_exception_state': | 327 'has_setter_exception_state': |
| 328 is_setter_raises_exception or has_type_checking_interface or | 328 is_setter_raises_exception or has_type_checking_interface or |
| 329 idl_type.v8_conversion_needs_exception_state, | 329 idl_type.v8_conversion_needs_exception_state, |
| 330 'has_type_checking_interface': has_type_checking_interface, | 330 'has_type_checking_interface': has_type_checking_interface, |
| 331 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value( | 331 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value( |
| 332 attribute, 'SetterCallWith', 'ExecutionContext'), | 332 attribute, 'SetterCallWith', 'ExecutionContext'), |
| 333 'is_setter_raises_exception': is_setter_raises_exception, | 333 'is_setter_raises_exception': is_setter_raises_exception, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 lambda self: strip_suffix(self.base_type, 'Constructor')) | 497 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 498 | 498 |
| 499 | 499 |
| 500 def is_constructor_attribute(attribute): | 500 def is_constructor_attribute(attribute): |
| 501 # FIXME: replace this with [ConstructorAttribute] extended attribute | 501 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 502 return attribute.idl_type.name.endswith('Constructor') | 502 return attribute.idl_type.name.endswith('Constructor') |
| 503 | 503 |
| 504 | 504 |
| 505 def constructor_getter_context(interface, attribute, context): | 505 def constructor_getter_context(interface, attribute, context): |
| 506 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 506 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| OLD | NEW |