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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 # [RaisesException], [RaisesException=Setter] | 316 # [RaisesException], [RaisesException=Setter] |
317 is_setter_raises_exception = ( | 317 is_setter_raises_exception = ( |
318 'RaisesException' in extended_attributes and | 318 'RaisesException' in extended_attributes and |
319 extended_attributes['RaisesException'] in [None, 'Setter']) | 319 extended_attributes['RaisesException'] in [None, 'Setter']) |
320 # [TypeChecking=Interface] | 320 # [TypeChecking=Interface] |
321 has_type_checking_interface = ( | 321 has_type_checking_interface = ( |
322 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or | 322 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or |
323 has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) a
nd | 323 has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) a
nd |
324 idl_type.is_wrapper_type) | 324 idl_type.is_wrapper_type) |
325 # [TypeChecking=Unrestricted] | |
326 restricted_float = ( | |
327 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or | |
328 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')) | |
329 | 325 |
330 context.update({ | 326 context.update({ |
331 'has_setter_exception_state': | 327 'has_setter_exception_state': |
332 is_setter_raises_exception or has_type_checking_interface or | 328 is_setter_raises_exception or has_type_checking_interface or |
333 idl_type.v8_conversion_needs_exception_state, | 329 idl_type.v8_conversion_needs_exception_state, |
334 'has_type_checking_interface': has_type_checking_interface, | 330 'has_type_checking_interface': has_type_checking_interface, |
335 '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( |
336 attribute, 'SetterCallWith', 'ExecutionContext'), | 332 attribute, 'SetterCallWith', 'ExecutionContext'), |
337 'is_setter_raises_exception': is_setter_raises_exception, | 333 'is_setter_raises_exception': is_setter_raises_exception, |
338 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 334 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
339 'cppValue', isolate='scriptState->isolate()', | 335 'cppValue', isolate='scriptState->isolate()', |
340 creation_context='scriptState->context()->Global()'), | 336 creation_context='scriptState->context()->Global()'), |
341 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( | 337 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
342 extended_attributes, 'v8Value', 'cppValue', restricted_float=restric
ted_float), | 338 extended_attributes, 'v8Value', 'cppValue'), |
343 }) | 339 }) |
344 | 340 |
345 # setter_expression() depends on context values we set above. | 341 # setter_expression() depends on context values we set above. |
346 context['cpp_setter'] = setter_expression(interface, attribute, context) | 342 context['cpp_setter'] = setter_expression(interface, attribute, context) |
347 | 343 |
348 | 344 |
349 def setter_expression(interface, attribute, context): | 345 def setter_expression(interface, attribute, context): |
350 extended_attributes = attribute.extended_attributes | 346 extended_attributes = attribute.extended_attributes |
351 arguments = v8_utilities.call_with_arguments( | 347 arguments = v8_utilities.call_with_arguments( |
352 extended_attributes.get('SetterCallWith') or | 348 extended_attributes.get('SetterCallWith') or |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 lambda self: strip_suffix(self.base_type, 'Constructor')) | 497 lambda self: strip_suffix(self.base_type, 'Constructor')) |
502 | 498 |
503 | 499 |
504 def is_constructor_attribute(attribute): | 500 def is_constructor_attribute(attribute): |
505 # FIXME: replace this with [ConstructorAttribute] extended attribute | 501 # FIXME: replace this with [ConstructorAttribute] extended attribute |
506 return attribute.idl_type.name.endswith('Constructor') | 502 return attribute.idl_type.name.endswith('Constructor') |
507 | 503 |
508 | 504 |
509 def constructor_getter_context(interface, attribute, context): | 505 def constructor_getter_context(interface, attribute, context): |
510 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 |