| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 if idl_type.is_typed_array_element_type and raw_type: | 179 if idl_type.is_typed_array_element_type and raw_type: |
| 180 return base_idl_type + '*' | 180 return base_idl_type + '*' |
| 181 if idl_type.is_interface_type: | 181 if idl_type.is_interface_type: |
| 182 implemented_as_class = idl_type.implemented_as | 182 implemented_as_class = idl_type.implemented_as |
| 183 if raw_type: | 183 if raw_type: |
| 184 return implemented_as_class + '*' | 184 return implemented_as_class + '*' |
| 185 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' | 185 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' |
| 186 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) | 186 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) |
| 187 return cpp_template_type(ptr_type, implemented_as_class) | 187 return cpp_template_type(ptr_type, implemented_as_class) |
| 188 if idl_type.is_dictionary: |
| 189 return base_idl_type |
| 188 # Default, assume native type is a pointer with same type name as idl type | 190 # Default, assume native type is a pointer with same type name as idl type |
| 189 return base_idl_type + '*' | 191 return base_idl_type + '*' |
| 190 | 192 |
| 191 | 193 |
| 192 def cpp_type_initializer(idl_type): | 194 def cpp_type_initializer(idl_type): |
| 193 """Returns a string containing a C++ initialization statement for the | 195 """Returns a string containing a C++ initialization statement for the |
| 194 corresponding type. | 196 corresponding type. |
| 195 | 197 |
| 196 |idl_type| argument is of type IdlType. | 198 |idl_type| argument is of type IdlType. |
| 197 """ | 199 """ |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 496 |
| 495 def v8_conversion_is_trivial(idl_type): | 497 def v8_conversion_is_trivial(idl_type): |
| 496 # The conversion is a simple expression that returns the converted value and | 498 # The conversion is a simple expression that returns the converted value and |
| 497 # cannot raise an exception. | 499 # cannot raise an exception. |
| 498 return (idl_type.base_type in TRIVIAL_CONVERSIONS or | 500 return (idl_type.base_type in TRIVIAL_CONVERSIONS or |
| 499 idl_type.is_wrapper_type) | 501 idl_type.is_wrapper_type) |
| 500 | 502 |
| 501 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) | 503 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) |
| 502 | 504 |
| 503 | 505 |
| 504 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, needs_type_ch
eck, index, isolate): | 506 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
, needs_type_check, index, isolate): |
| 505 if idl_type.name == 'void': | 507 if idl_type.name == 'void': |
| 506 return '' | 508 return '' |
| 507 | 509 |
| 508 # Array or sequence types | 510 # Array or sequence types |
| 509 native_array_element_type = idl_type.native_array_element_type | 511 native_array_element_type = idl_type.native_array_element_type |
| 510 if native_array_element_type: | 512 if native_array_element_type: |
| 511 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type
, v8_value, index) | 513 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type
, v8_value, index) |
| 512 | 514 |
| 513 # Simple types | 515 # Simple types |
| 514 idl_type = idl_type.preprocessed_type | 516 idl_type = idl_type.preprocessed_type |
| 515 add_includes_for_type(idl_type) | 517 add_includes_for_type(idl_type) |
| 516 base_idl_type = idl_type.base_type | 518 base_idl_type = idl_type.base_type |
| 517 | 519 |
| 518 if 'EnforceRange' in extended_attributes: | 520 if 'EnforceRange' in extended_attributes: |
| 519 arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) | 521 arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) |
| 520 elif 'Clamp' in extended_attributes: | 522 elif 'Clamp' in extended_attributes: |
| 521 arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) | 523 arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) |
| 522 elif idl_type.v8_conversion_needs_exception_state: | 524 elif idl_type.v8_conversion_needs_exception_state: |
| 523 arguments = ', '.join([v8_value, 'exceptionState']) | 525 arguments = ', '.join([v8_value, 'exceptionState']) |
| 524 else: | 526 else: |
| 525 arguments = v8_value | 527 arguments = v8_value |
| 526 | 528 |
| 527 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 529 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
| 528 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 530 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
| 529 elif idl_type.is_typed_array_element_type: | 531 elif idl_type.is_typed_array_element_type: |
| 530 cpp_expression_format = ( | 532 cpp_expression_format = ( |
| 531 '{v8_value}->Is{idl_type}() ? ' | 533 '{v8_value}->Is{idl_type}() ? ' |
| 532 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value}))
: 0') | 534 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value}))
: 0') |
| 533 elif idl_type.is_dictionary: | 535 elif idl_type.is_dictionary: |
| 534 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exc
eptionState)' | 536 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, exceptionState)' |
| 535 elif needs_type_check: | 537 elif needs_type_check: |
| 536 cpp_expression_format = ( | 538 cpp_expression_format = ( |
| 537 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') | 539 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') |
| 538 else: | 540 else: |
| 539 cpp_expression_format = ( | 541 cpp_expression_format = ( |
| 540 'V8{idl_type}::toImpl(v8::Handle<v8::Object>::Cast({v8_value}))') | 542 'V8{idl_type}::toImpl(v8::Handle<v8::Object>::Cast({v8_value}))') |
| 541 | 543 |
| 542 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t
ype, v8_value=v8_value, isolate=isolate) | 544 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t
ype, v8_value=v8_value, variable_name=variable_name, isolate=isolate) |
| 543 | 545 |
| 544 | 546 |
| 545 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
index, isolate='info.GetIsolate()'): | 547 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
index, isolate='info.GetIsolate()'): |
| 546 # Index is None for setters, index (starting at 0) for method arguments, | 548 # Index is None for setters, index (starting at 0) for method arguments, |
| 547 # and is used to provide a human-readable exception message | 549 # and is used to provide a human-readable exception message |
| 548 if index is None: | 550 if index is None: |
| 549 index = 0 # special case, meaning "setter" | 551 index = 0 # special case, meaning "setter" |
| 550 else: | 552 else: |
| 551 index += 1 # human-readable index | 553 index += 1 # human-readable index |
| 552 if (native_array_element_type.is_interface_type and | 554 if (native_array_element_type.is_interface_type and |
| 553 native_array_element_type.name != 'Dictionary'): | 555 native_array_element_type.name != 'Dictionary'): |
| 554 this_cpp_type = None | 556 this_cpp_type = None |
| 555 ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_typ
e.gc_type) | 557 ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_typ
e.gc_type) |
| 556 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_
type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS
tate))' | 558 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_
type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS
tate))' |
| 557 add_includes_for_type(native_array_element_type) | 559 add_includes_for_type(native_array_element_type) |
| 558 else: | 560 else: |
| 559 ref_ptr_type = None | 561 ref_ptr_type = None |
| 560 this_cpp_type = native_array_element_type.cpp_type | 562 this_cpp_type = native_array_element_type.cpp_type |
| 561 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola
te}, exceptionState)' | 563 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola
te}, exceptionState)' |
| 562 expression = expression_format.format(native_array_element_type=native_array
_element_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_ty
pe, v8_value=v8_value, isolate=isolate) | 564 expression = expression_format.format(native_array_element_type=native_array
_element_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_ty
pe, v8_value=v8_value, isolate=isolate) |
| 563 return expression | 565 return expression |
| 564 | 566 |
| 565 | 567 |
| 566 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name, needs_type_check=True, index=None, declare_variable=True, isolate='info.
GetIsolate()', used_in_private_script=False, return_promise=False): | 568 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name=None, needs_type_check=True, index=None, declare_variable=True, isolate='
info.GetIsolate()', used_in_private_script=False, return_promise=False): |
| 567 """Returns an expression that converts a V8 value to a C++ value and stores
it as a local value.""" | 569 """Returns an expression that converts a V8 value to a C++ value and stores
it as a local value.""" |
| 568 | 570 |
| 569 # FIXME: Support union type. | 571 # FIXME: Support union type. |
| 570 if idl_type.is_union_type: | 572 if idl_type.is_union_type: |
| 571 return '/* no V8 -> C++ conversion for IDL union type: %s */' % idl_type
.name | 573 return '/* no V8 -> C++ conversion for IDL union type: %s */' % idl_type
.name |
| 572 | 574 |
| 573 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut
es, raw_type=True) | 575 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut
es, raw_type=True) |
| 574 idl_type = idl_type.preprocessed_type | 576 idl_type = idl_type.preprocessed_type |
| 575 | 577 |
| 576 if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener')
: | 578 if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener')
: |
| 577 return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name | 579 return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name |
| 578 | 580 |
| 579 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, n
eeds_type_check, index, isolate) | 581 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, v
ariable_name, needs_type_check, index, isolate) |
| 582 |
| 583 if idl_type.is_dictionary: |
| 584 return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(%s, exceptionState)' %
cpp_value |
| 585 |
| 580 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: | 586 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: |
| 581 # Types that need error handling and use one of a group of (C++) macros | 587 # Types that need error handling and use one of a group of (C++) macros |
| 582 # to take care of this. | 588 # to take care of this. |
| 583 | 589 |
| 584 args = [variable_name, cpp_value] | 590 args = [variable_name, cpp_value] |
| 585 | 591 |
| 586 if idl_type.v8_conversion_needs_exception_state: | 592 if idl_type.v8_conversion_needs_exception_state: |
| 587 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script
else 'TONATIVE_VOID_EXCEPTIONSTATE' | 593 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script
else 'TONATIVE_VOID_EXCEPTIONSTATE' |
| 588 elif return_promise: | 594 elif return_promise: |
| 589 macro = 'TOSTRING_VOID_EXCEPTIONSTATE' | 595 macro = 'TOSTRING_VOID_EXCEPTIONSTATE' |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 The V8 conversion type is used to select the C++ -> V8 conversion function | 678 The V8 conversion type is used to select the C++ -> V8 conversion function |
| 673 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a | 679 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a |
| 674 separate name for the type of conversion (e.g., 'DOMWrapper'). | 680 separate name for the type of conversion (e.g., 'DOMWrapper'). |
| 675 """ | 681 """ |
| 676 extended_attributes = extended_attributes or {} | 682 extended_attributes = extended_attributes or {} |
| 677 | 683 |
| 678 # FIXME: Support union type. | 684 # FIXME: Support union type. |
| 679 if idl_type.is_union_type: | 685 if idl_type.is_union_type: |
| 680 return '' | 686 return '' |
| 681 | 687 |
| 688 if idl_type.is_dictionary: |
| 689 return 'IDLDictionary' |
| 690 |
| 682 # Array or sequence types | 691 # Array or sequence types |
| 683 native_array_element_type = idl_type.native_array_element_type | 692 native_array_element_type = idl_type.native_array_element_type |
| 684 if native_array_element_type: | 693 if native_array_element_type: |
| 685 if native_array_element_type.is_interface_type: | 694 if native_array_element_type.is_interface_type: |
| 686 add_includes_for_type(native_array_element_type) | 695 add_includes_for_type(native_array_element_type) |
| 687 return 'array' | 696 return 'array' |
| 688 | 697 |
| 689 # Simple types | 698 # Simple types |
| 690 base_idl_type = idl_type.base_type | 699 base_idl_type = idl_type.base_type |
| 691 # Basic types, without additional includes | 700 # Basic types, without additional includes |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 # and then use general v8SetReturnValue. | 747 # and then use general v8SetReturnValue. |
| 739 'array': 'v8SetReturnValue(info, {cpp_value})', | 748 'array': 'v8SetReturnValue(info, {cpp_value})', |
| 740 'Date': 'v8SetReturnValue(info, {cpp_value})', | 749 'Date': 'v8SetReturnValue(info, {cpp_value})', |
| 741 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', | 750 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', |
| 742 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 751 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 743 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 752 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 744 # DOMWrapper | 753 # DOMWrapper |
| 745 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({c
pp_value}))', | 754 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({c
pp_value}))', |
| 746 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {scr
ipt_wrappable})', | 755 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {scr
ipt_wrappable})', |
| 747 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', | 756 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', |
| 757 'IDLDictionary': 'v8SetReturnValue(info, cppValue)', |
| 748 } | 758 } |
| 749 | 759 |
| 750 | 760 |
| 751 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr
appable='', release=False, for_main_world=False): | 761 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr
appable='', release=False, for_main_world=False): |
| 752 """Returns a statement that converts a C++ value to a V8 value and sets it a
s a return value. | 762 """Returns a statement that converts a C++ value to a V8 value and sets it a
s a return value. |
| 753 | 763 |
| 754 """ | 764 """ |
| 755 def dom_wrapper_conversion_type(): | 765 def dom_wrapper_conversion_type(): |
| 756 if not script_wrappable: | 766 if not script_wrappable: |
| 757 return 'DOMWrapperDefault' | 767 return 'DOMWrapperDefault' |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 # [TreatReturnedNullStringAs] | 818 # [TreatReturnedNullStringAs] |
| 809 'StringOrNull': '{cpp_value}.isNull() ? v8::Handle<v8::Value>(v8::Null({isol
ate})) : v8String({isolate}, {cpp_value})', | 819 'StringOrNull': '{cpp_value}.isNull() ? v8::Handle<v8::Value>(v8::Null({isol
ate})) : v8String({isolate}, {cpp_value})', |
| 810 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola
te}, {cpp_value})', | 820 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola
te}, {cpp_value})', |
| 811 # Special cases | 821 # Special cases |
| 812 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener
::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v
8::Value>(v8::Null({isolate}))', | 822 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener
::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v
8::Value>(v8::Null({isolate}))', |
| 813 'ScriptValue': '{cpp_value}.v8Value()', | 823 'ScriptValue': '{cpp_value}.v8Value()', |
| 814 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Han
dle<v8::Value>(v8::Null({isolate}))', | 824 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Han
dle<v8::Value>(v8::Null({isolate}))', |
| 815 # General | 825 # General |
| 816 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})', | 826 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})', |
| 817 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', | 827 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', |
| 828 'IDLDictionary': 'toV8({cpp_value}, {creation_context}, {isolate})', |
| 818 } | 829 } |
| 819 | 830 |
| 820 | 831 |
| 821 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='info.Holder()', extended_attributes=None): | 832 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='info.Holder()', extended_attributes=None): |
| 822 """Returns an expression that converts a C++ value to a V8 value.""" | 833 """Returns an expression that converts a C++ value to a V8 value.""" |
| 823 # the isolate parameter is needed for callback interfaces | 834 # the isolate parameter is needed for callback interfaces |
| 824 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) | 835 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) |
| 825 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) | 836 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) |
| 826 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] | 837 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] |
| 827 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) | 838 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 845 # Utility properties for nullable types | 856 # Utility properties for nullable types |
| 846 ################################################################################ | 857 ################################################################################ |
| 847 | 858 |
| 848 | 859 |
| 849 def cpp_type_has_null_value(idl_type): | 860 def cpp_type_has_null_value(idl_type): |
| 850 # - String types (String/AtomicString) represent null as a null string, | 861 # - String types (String/AtomicString) represent null as a null string, |
| 851 # i.e. one for which String::isNull() returns true. | 862 # i.e. one for which String::isNull() returns true. |
| 852 # - Enum types, as they are implemented as Strings. | 863 # - Enum types, as they are implemented as Strings. |
| 853 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as | 864 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as |
| 854 # a null pointer. | 865 # a null pointer. |
| 855 # - Dictionary types represent null as a null pointer. They are garbage | |
| 856 # collected so their type is raw pointer. | |
| 857 # - 'Object' type. We use ScriptValue for object type. | 866 # - 'Object' type. We use ScriptValue for object type. |
| 858 return (idl_type.is_string_type or idl_type.is_wrapper_type or | 867 return (idl_type.is_string_type or idl_type.is_wrapper_type or |
| 859 idl_type.is_enum or idl_type.is_dictionary or idl_type.base_type ==
'object') | 868 idl_type.is_enum or idl_type.base_type == 'object') |
| 860 | 869 |
| 861 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) | 870 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) |
| 862 | 871 |
| 863 | 872 |
| 864 def is_implicit_nullable(idl_type): | 873 def is_implicit_nullable(idl_type): |
| 865 # Nullable type where the corresponding C++ type supports a null value. | 874 # Nullable type where the corresponding C++ type supports a null value. |
| 866 return idl_type.is_nullable and idl_type.cpp_type_has_null_value | 875 return idl_type.is_nullable and idl_type.cpp_type_has_null_value |
| 867 | 876 |
| 868 | 877 |
| 869 def is_explicit_nullable(idl_type): | 878 def is_explicit_nullable(idl_type): |
| 870 # Nullable type that isn't implicit nullable (see above.) For such types, | 879 # Nullable type that isn't implicit nullable (see above.) For such types, |
| 871 # we use Nullable<T> or similar explicit ways to represent a null value. | 880 # we use Nullable<T> or similar explicit ways to represent a null value. |
| 872 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 881 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
| 873 | 882 |
| 874 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 883 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) |
| 875 IdlUnionType.is_implicit_nullable = False | 884 IdlUnionType.is_implicit_nullable = False |
| 876 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 885 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
| OLD | NEW |