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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 325 |
| 326 type_checked = (has_type_checking_interface and |
| 327 # These allow null values, so a type-check is still required
. |
| 328 not idl_type.is_nullable) |
| 329 |
326 context.update({ | 330 context.update({ |
327 'has_setter_exception_state': | 331 'has_setter_exception_state': |
328 is_setter_raises_exception or has_type_checking_interface or | 332 is_setter_raises_exception or has_type_checking_interface or |
329 context['has_type_checking_unrestricted'] or | 333 context['has_type_checking_unrestricted'] or |
330 idl_type.v8_conversion_needs_exception_state, | 334 idl_type.v8_conversion_needs_exception_state, |
331 'has_type_checking_interface': has_type_checking_interface, | 335 'has_type_checking_interface': has_type_checking_interface, |
332 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value( | 336 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value( |
333 attribute, 'SetterCallWith', 'ExecutionContext'), | 337 attribute, 'SetterCallWith', 'ExecutionContext'), |
334 'is_setter_raises_exception': is_setter_raises_exception, | 338 'is_setter_raises_exception': is_setter_raises_exception, |
335 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 339 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
336 'cppValue', isolate='scriptState->isolate()', | 340 'cppValue', isolate='scriptState->isolate()', |
337 creation_context='scriptState->context()->Global()'), | 341 creation_context='scriptState->context()->Global()'), |
338 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( | 342 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
339 extended_attributes, 'v8Value', 'cppValue'), | 343 extended_attributes, 'v8Value', 'cppValue', |
| 344 needs_type_check=not type_checked), |
340 }) | 345 }) |
341 | 346 |
342 # setter_expression() depends on context values we set above. | 347 # setter_expression() depends on context values we set above. |
343 context['cpp_setter'] = setter_expression(interface, attribute, context) | 348 context['cpp_setter'] = setter_expression(interface, attribute, context) |
344 | 349 |
345 | 350 |
346 def setter_expression(interface, attribute, context): | 351 def setter_expression(interface, attribute, context): |
347 extended_attributes = attribute.extended_attributes | 352 extended_attributes = attribute.extended_attributes |
348 arguments = v8_utilities.call_with_arguments( | 353 arguments = v8_utilities.call_with_arguments( |
349 extended_attributes.get('SetterCallWith') or | 354 extended_attributes.get('SetterCallWith') or |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 lambda self: strip_suffix(self.base_type, 'Constructor')) | 498 lambda self: strip_suffix(self.base_type, 'Constructor')) |
494 | 499 |
495 | 500 |
496 def is_constructor_attribute(attribute): | 501 def is_constructor_attribute(attribute): |
497 # FIXME: replace this with [ConstructorAttribute] extended attribute | 502 # FIXME: replace this with [ConstructorAttribute] extended attribute |
498 return attribute.idl_type.name.endswith('Constructor') | 503 return attribute.idl_type.name.endswith('Constructor') |
499 | 504 |
500 | 505 |
501 def constructor_getter_context(interface, attribute, context): | 506 def constructor_getter_context(interface, attribute, context): |
502 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 507 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |