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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 return 'result.isNull()' | 542 return 'result.isNull()' |
543 if idl_type.is_interface_type: | 543 if idl_type.is_interface_type: |
544 return '!result' | 544 return '!result' |
545 return '' | 545 return '' |
546 | 546 |
547 idl_type = getter.idl_type | 547 idl_type = getter.idl_type |
548 extended_attributes = getter.extended_attributes | 548 extended_attributes = getter.extended_attributes |
549 is_raises_exception = 'RaisesException' in extended_attributes | 549 is_raises_exception = 'RaisesException' in extended_attributes |
550 | 550 |
551 # FIXME: make more generic, so can use v8_methods.cpp_value | 551 # FIXME: make more generic, so can use v8_methods.cpp_value |
552 cpp_method_name = 'imp->%s' % cpp_name(getter) | 552 cpp_method_name = 'impl->%s' % cpp_name(getter) |
553 | 553 |
554 if is_raises_exception: | 554 if is_raises_exception: |
555 cpp_arguments.append('exceptionState') | 555 cpp_arguments.append('exceptionState') |
556 union_arguments = idl_type.union_arguments | 556 union_arguments = idl_type.union_arguments |
557 if union_arguments: | 557 if union_arguments: |
558 cpp_arguments.extend(union_arguments) | 558 cpp_arguments.extend(union_arguments) |
559 | 559 |
560 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) | 560 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) |
561 | 561 |
562 return { | 562 return { |
563 'cpp_type': idl_type.cpp_type, | 563 'cpp_type': idl_type.cpp_type, |
564 'cpp_value': cpp_value, | 564 'cpp_value': cpp_value, |
565 'is_custom': | 565 'is_custom': |
566 'Custom' in extended_attributes and | 566 'Custom' in extended_attributes and |
567 (not extended_attributes['Custom'] or | 567 (not extended_attributes['Custom'] or |
568 has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), | 568 has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), |
569 'is_custom_property_enumerator': has_extended_attribute_value( | 569 'is_custom_property_enumerator': has_extended_attribute_value( |
570 getter, 'Custom', 'PropertyEnumerator'), | 570 getter, 'Custom', 'PropertyEnumerator'), |
571 'is_custom_property_query': has_extended_attribute_value( | 571 'is_custom_property_query': has_extended_attribute_value( |
572 getter, 'Custom', 'PropertyQuery'), | 572 getter, 'Custom', 'PropertyQuery'), |
573 'is_enumerable': 'NotEnumerable' not in extended_attributes, | 573 'is_enumerable': 'NotEnumerable' not in extended_attributes, |
574 'is_null_expression': is_null_expression(idl_type), | 574 'is_null_expression': is_null_expression(idl_type), |
575 'is_raises_exception': is_raises_exception, | 575 'is_raises_exception': is_raises_exception, |
576 'name': cpp_name(getter), | 576 'name': cpp_name(getter), |
577 'union_arguments': union_arguments, | 577 'union_arguments': union_arguments, |
578 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a
ttributes=extended_attributes, script_wrappable='imp', release=idl_type.release)
, | 578 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a
ttributes=extended_attributes, script_wrappable='impl', release=idl_type.release
), |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 def property_setter(setter): | 582 def property_setter(setter): |
583 idl_type = setter.arguments[1].idl_type | 583 idl_type = setter.arguments[1].idl_type |
584 extended_attributes = setter.extended_attributes | 584 extended_attributes = setter.extended_attributes |
585 is_raises_exception = 'RaisesException' in extended_attributes | 585 is_raises_exception = 'RaisesException' in extended_attributes |
586 return { | 586 return { |
587 'has_strict_type_checking': | 587 'has_strict_type_checking': |
588 'StrictTypeChecking' in extended_attributes and | 588 'StrictTypeChecking' in extended_attributes and |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 deleter = next( | 710 deleter = next( |
711 method | 711 method |
712 for method in interface.operations | 712 for method in interface.operations |
713 if ('deleter' in method.specials and | 713 if ('deleter' in method.specials and |
714 len(method.arguments) == 1 and | 714 len(method.arguments) == 1 and |
715 str(method.arguments[0].idl_type) == 'DOMString')) | 715 str(method.arguments[0].idl_type) == 'DOMString')) |
716 except StopIteration: | 716 except StopIteration: |
717 return None | 717 return None |
718 | 718 |
719 return property_deleter(deleter) | 719 return property_deleter(deleter) |
OLD | NEW |