Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 680193003: IDL: Generate union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return idl_type.implemented_as + '*' 185 return idl_type.implemented_as + '*'
186 if idl_type.is_interface_type: 186 if idl_type.is_interface_type:
187 implemented_as_class = idl_type.implemented_as 187 implemented_as_class = idl_type.implemented_as
188 if raw_type: 188 if raw_type:
189 return implemented_as_class + '*' 189 return implemented_as_class + '*'
190 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' 190 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
191 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt r'), new_type, idl_type.gc_type) 191 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt r'), new_type, idl_type.gc_type)
192 return cpp_template_type(ptr_type, implemented_as_class) 192 return cpp_template_type(ptr_type, implemented_as_class)
193 if idl_type.is_dictionary: 193 if idl_type.is_dictionary:
194 return base_idl_type 194 return base_idl_type
195 if idl_type.is_union_type:
196 return idl_type.name
197
195 # Default, assume native type is a pointer with same type name as idl type 198 # Default, assume native type is a pointer with same type name as idl type
196 return base_idl_type + '*' 199 return base_idl_type + '*'
197 200
198 201
199 def cpp_type_initializer(idl_type): 202 def cpp_type_initializer(idl_type):
200 """Returns a string containing a C++ initialization statement for the 203 """Returns a string containing a C++ initialization statement for the
201 corresponding type. 204 corresponding type.
202 205
203 |idl_type| argument is of type IdlType. 206 |idl_type| argument is of type IdlType.
204 """ 207 """
205 208
206 base_idl_type = idl_type.base_type 209 base_idl_type = idl_type.base_type
207 210
208 if idl_type.native_array_element_type: 211 if idl_type.native_array_element_type:
209 return '' 212 return ''
210 if idl_type.is_numeric_type: 213 if idl_type.is_numeric_type:
211 return ' = 0' 214 return ' = 0'
212 if base_idl_type == 'boolean': 215 if base_idl_type == 'boolean':
213 return ' = false' 216 return ' = false'
214 if (base_idl_type in NON_WRAPPER_TYPES or 217 if (base_idl_type in NON_WRAPPER_TYPES or
215 base_idl_type in CPP_SPECIAL_CONVERSION_RULES or 218 base_idl_type in CPP_SPECIAL_CONVERSION_RULES or
216 base_idl_type == 'any' or 219 base_idl_type == 'any' or
217 idl_type.is_string_type or 220 idl_type.is_string_type or
218 idl_type.is_enum): 221 idl_type.is_enum):
219 return '' 222 return ''
220 return ' = nullptr' 223 return ' = nullptr'
221 224
222 225
223 def cpp_type_union(idl_type, extended_attributes=None, raw_type=False):
224 # FIXME: Need to revisit the design of union support.
225 # http://crbug.com/240176
226 return None
227
228
229 def cpp_type_initializer_union(idl_type):
230 return (member_type.cpp_type_initializer for member_type in idl_type.member_ types)
231
232
233 # Allow access as idl_type.cpp_type if no arguments 226 # Allow access as idl_type.cpp_type if no arguments
234 IdlTypeBase.cpp_type = property(cpp_type) 227 IdlTypeBase.cpp_type = property(cpp_type)
235 IdlTypeBase.cpp_type_initializer = property(cpp_type_initializer) 228 IdlTypeBase.cpp_type_initializer = property(cpp_type_initializer)
236 IdlTypeBase.cpp_type_args = cpp_type 229 IdlTypeBase.cpp_type_args = cpp_type
237 IdlUnionType.cpp_type = property(cpp_type_union) 230 IdlUnionType.cpp_type_initializer = ''
238 IdlUnionType.cpp_type_initializer = property(cpp_type_initializer_union)
239 IdlUnionType.cpp_type_args = cpp_type_union
240 231
241 232
242 IdlArrayOrSequenceType.native_array_element_type = property( 233 IdlArrayOrSequenceType.native_array_element_type = property(
243 lambda self: self.element_type) 234 lambda self: self.element_type)
244 235
245 236
246 def cpp_template_type(template, inner_type): 237 def cpp_template_type(template, inner_type):
247 """Returns C++ template specialized to type, with space added if needed.""" 238 """Returns C++ template specialized to type, with space added if needed."""
248 if inner_type.endswith('>'): 239 if inner_type.endswith('>'):
249 format_string = '{template}<{inner_type} >' 240 format_string = '{template}<{inner_type} >'
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 468 }
478 469
479 470
480 def v8_conversion_needs_exception_state(idl_type): 471 def v8_conversion_needs_exception_state(idl_type):
481 return (idl_type.is_numeric_type or 472 return (idl_type.is_numeric_type or
482 idl_type.is_dictionary or 473 idl_type.is_dictionary or
483 idl_type.name in ('ByteString', 'USVString', 'SerializedScriptValue' )) 474 idl_type.name in ('ByteString', 'USVString', 'SerializedScriptValue' ))
484 475
485 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) 476 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state)
486 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True 477 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True
478 IdlUnionType.v8_conversion_needs_exception_state = True
487 479
488 480
489 TRIVIAL_CONVERSIONS = frozenset([ 481 TRIVIAL_CONVERSIONS = frozenset([
490 'any', 482 'any',
491 'boolean', 483 'boolean',
492 'Date', 484 'Date',
493 'Dictionary', 485 'Dictionary',
494 'NodeFilter', 486 'NodeFilter',
495 'XPathNSResolver', 487 'XPathNSResolver',
496 'Promise' 488 'Promise'
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_ type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS tate))' 553 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_ type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS tate))'
562 add_includes_for_type(native_array_element_type) 554 add_includes_for_type(native_array_element_type)
563 else: 555 else:
564 ref_ptr_type = None 556 ref_ptr_type = None
565 this_cpp_type = native_array_element_type.cpp_type 557 this_cpp_type = native_array_element_type.cpp_type
566 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola te}, exceptionState)' 558 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola te}, exceptionState)'
567 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) 559 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)
568 return expression 560 return expression
569 561
570 562
571 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): 563 # FIXME: this function should be refactored, as this takes too many flags.
564 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, needs_ex ception_state_for_string=False):
572 """Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" 565 """Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
573 566
574 # FIXME: Support union type. 567 # FIXME: Support union type.
575 if idl_type.is_union_type: 568 if idl_type.is_union_type:
576 return '/* no V8 -> C++ conversion for IDL union type: %s */' % idl_type .name 569 return '/* no V8 -> C++ conversion for IDL union type: %s */' % idl_type .name
577 570
578 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es, raw_type=True) 571 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es, raw_type=True)
579 idl_type = idl_type.preprocessed_type 572 idl_type = idl_type.preprocessed_type
580 573
581 if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener') : 574 if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener') :
582 return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name 575 return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name
583 576
584 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, v ariable_name, needs_type_check, index, isolate) 577 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, v ariable_name, needs_type_check, index, isolate)
585 578
586 if idl_type.is_dictionary: 579 if idl_type.is_dictionary:
587 return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(%s, exceptionState)' % cpp_value 580 return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(%s, exceptionState)' % cpp_value
588 581
589 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: 582 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state:
590 # Types that need error handling and use one of a group of (C++) macros 583 # Types that need error handling and use one of a group of (C++) macros
591 # to take care of this. 584 # to take care of this.
592 585
593 args = [variable_name, cpp_value] 586 args = [variable_name, cpp_value]
594 587
595 if idl_type.v8_conversion_needs_exception_state: 588 if idl_type.v8_conversion_needs_exception_state:
596 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE' 589 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE'
597 elif return_promise: 590 elif return_promise or needs_exception_state_for_string:
598 macro = 'TOSTRING_VOID_EXCEPTIONSTATE' 591 macro = 'TOSTRING_VOID_EXCEPTIONSTATE'
599 else: 592 else:
600 macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_ VOID' 593 macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_ VOID'
601 594
602 if macro.endswith('_EXCEPTIONSTATE'): 595 if macro.endswith('_EXCEPTIONSTATE'):
603 args.append('exceptionState') 596 args.append('exceptionState')
604 597
605 if used_in_private_script: 598 if used_in_private_script:
606 args.append('false') 599 args.append('false')
607 600
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 670
678 def v8_conversion_type(idl_type, extended_attributes): 671 def v8_conversion_type(idl_type, extended_attributes):
679 """Returns V8 conversion type, adding any additional includes. 672 """Returns V8 conversion type, adding any additional includes.
680 673
681 The V8 conversion type is used to select the C++ -> V8 conversion function 674 The V8 conversion type is used to select the C++ -> V8 conversion function
682 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a 675 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a
683 separate name for the type of conversion (e.g., 'DOMWrapper'). 676 separate name for the type of conversion (e.g., 'DOMWrapper').
684 """ 677 """
685 extended_attributes = extended_attributes or {} 678 extended_attributes = extended_attributes or {}
686 679
687 # FIXME: Support union type. 680 if idl_type.is_dictionary or idl_type.is_union_type:
688 if idl_type.is_union_type: 681 return 'DictionaryOrUnion'
689 return ''
690
691 if idl_type.is_dictionary:
692 return 'IDLDictionary'
693 682
694 # Array or sequence types 683 # Array or sequence types
695 native_array_element_type = idl_type.native_array_element_type 684 native_array_element_type = idl_type.native_array_element_type
696 if native_array_element_type: 685 if native_array_element_type:
697 if native_array_element_type.is_interface_type: 686 if native_array_element_type.is_interface_type:
698 add_includes_for_type(native_array_element_type) 687 add_includes_for_type(native_array_element_type)
699 return 'array' 688 return 'array'
700 689
701 # Simple types 690 # Simple types
702 base_idl_type = idl_type.base_type 691 base_idl_type = idl_type.base_type
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 # and then use general v8SetReturnValue. 739 # and then use general v8SetReturnValue.
751 'array': 'v8SetReturnValue(info, {cpp_value})', 740 'array': 'v8SetReturnValue(info, {cpp_value})',
752 'Date': 'v8SetReturnValue(info, {cpp_value})', 741 'Date': 'v8SetReturnValue(info, {cpp_value})',
753 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', 742 'EventHandler': 'v8SetReturnValue(info, {cpp_value})',
754 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', 743 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})',
755 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', 744 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})',
756 # DOMWrapper 745 # DOMWrapper
757 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({c pp_value}))', 746 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({c pp_value}))',
758 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {scr ipt_wrappable})', 747 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {scr ipt_wrappable})',
759 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', 748 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})',
760 'IDLDictionary': 'v8SetReturnValue(info, result)', 749 # Union types or dictionaries
750 'DictionaryOrUnion': 'v8SetReturnValue(info, result)',
761 } 751 }
762 752
763 753
764 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr appable='', release=False, for_main_world=False): 754 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr appable='', release=False, for_main_world=False):
765 """Returns a statement that converts a C++ value to a V8 value and sets it a s a return value. 755 """Returns a statement that converts a C++ value to a V8 value and sets it a s a return value.
766 756
767 """ 757 """
768 def dom_wrapper_conversion_type(): 758 def dom_wrapper_conversion_type():
769 if not script_wrappable: 759 if not script_wrappable:
770 return 'DOMWrapperDefault' 760 return 'DOMWrapperDefault'
(...skipping 11 matching lines...) Expand all
782 this_v8_conversion_type = dom_wrapper_conversion_type() 772 this_v8_conversion_type = dom_wrapper_conversion_type()
783 773
784 format_string = V8_SET_RETURN_VALUE[this_v8_conversion_type] 774 format_string = V8_SET_RETURN_VALUE[this_v8_conversion_type]
785 # FIXME: oilpan: Remove .release() once we remove all RefPtrs from generated code. 775 # FIXME: oilpan: Remove .release() once we remove all RefPtrs from generated code.
786 if release: 776 if release:
787 cpp_value = '%s.release()' % cpp_value 777 cpp_value = '%s.release()' % cpp_value
788 statement = format_string.format(cpp_value=cpp_value, script_wrappable=scrip t_wrappable) 778 statement = format_string.format(cpp_value=cpp_value, script_wrappable=scrip t_wrappable)
789 return statement 779 return statement
790 780
791 781
792 def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, scr ipt_wrappable='', release=False, for_main_world=False):
793 # FIXME: Need to revisit the design of union support.
794 # http://crbug.com/240176
795 return None
796
797
798 IdlTypeBase.v8_set_return_value = v8_set_return_value 782 IdlTypeBase.v8_set_return_value = v8_set_return_value
799 IdlUnionType.v8_set_return_value = v8_set_return_value_union
800 783
801 IdlType.release = property(lambda self: self.is_interface_type) 784 IdlType.release = property(lambda self: self.is_interface_type)
802 IdlUnionType.release = property( 785 IdlUnionType.release = False
803 lambda self: [member_type.is_interface_type
804 for member_type in self.member_types])
805 786
806 787
807 CPP_VALUE_TO_V8_VALUE = { 788 CPP_VALUE_TO_V8_VALUE = {
808 # Built-in types 789 # Built-in types
809 'Date': 'v8DateOrNaN({cpp_value}, {isolate})', 790 'Date': 'v8DateOrNaN({cpp_value}, {isolate})',
810 'DOMString': 'v8String({isolate}, {cpp_value})', 791 'DOMString': 'v8String({isolate}, {cpp_value})',
811 'ByteString': 'v8String({isolate}, {cpp_value})', 792 'ByteString': 'v8String({isolate}, {cpp_value})',
812 'USVString': 'v8String({isolate}, {cpp_value})', 793 'USVString': 'v8String({isolate}, {cpp_value})',
813 'boolean': 'v8Boolean({cpp_value}, {isolate})', 794 'boolean': 'v8Boolean({cpp_value}, {isolate})',
814 'int': 'v8::Integer::New({isolate}, {cpp_value})', 795 'int': 'v8::Integer::New({isolate}, {cpp_value})',
815 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})', 796 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})',
816 'float': 'v8::Number::New({isolate}, {cpp_value})', 797 'float': 'v8::Number::New({isolate}, {cpp_value})',
817 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})', 798 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})',
818 'double': 'v8::Number::New({isolate}, {cpp_value})', 799 'double': 'v8::Number::New({isolate}, {cpp_value})',
819 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})', 800 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})',
820 'void': 'v8Undefined()', 801 'void': 'v8Undefined()',
821 # [TreatReturnedNullStringAs] 802 # [TreatReturnedNullStringAs]
822 'StringOrNull': '{cpp_value}.isNull() ? v8::Handle<v8::Value>(v8::Null({isol ate})) : v8String({isolate}, {cpp_value})', 803 'StringOrNull': '{cpp_value}.isNull() ? v8::Handle<v8::Value>(v8::Null({isol ate})) : v8String({isolate}, {cpp_value})',
823 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola te}, {cpp_value})', 804 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola te}, {cpp_value})',
824 # Special cases 805 # Special cases
825 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener ::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v 8::Value>(v8::Null({isolate}))', 806 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener ::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v 8::Value>(v8::Null({isolate}))',
826 'ScriptValue': '{cpp_value}.v8Value()', 807 'ScriptValue': '{cpp_value}.v8Value()',
827 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Han dle<v8::Value>(v8::Null({isolate}))', 808 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Han dle<v8::Value>(v8::Null({isolate}))',
828 # General 809 # General
829 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})', 810 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})',
830 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', 811 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})',
831 'IDLDictionary': 'toV8({cpp_value}, {creation_context}, {isolate})', 812 # Union types or dictionaries
813 'DictionaryOrUnion': 'toV8({cpp_value}, {creation_context}, {isolate})',
832 } 814 }
833 815
834 816
835 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='info.Holder()', extended_attributes=None): 817 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='info.Holder()', extended_attributes=None):
836 """Returns an expression that converts a C++ value to a V8 value.""" 818 """Returns an expression that converts a C++ value to a V8 value."""
837 # the isolate parameter is needed for callback interfaces 819 # the isolate parameter is needed for callback interfaces
838 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes) 820 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes)
839 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) 821 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
840 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] 822 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
841 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context) 823 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 861
880 862
881 def is_explicit_nullable(idl_type): 863 def is_explicit_nullable(idl_type):
882 # Nullable type that isn't implicit nullable (see above.) For such types, 864 # Nullable type that isn't implicit nullable (see above.) For such types,
883 # we use Nullable<T> or similar explicit ways to represent a null value. 865 # we use Nullable<T> or similar explicit ways to represent a null value.
884 return idl_type.is_nullable and not idl_type.is_implicit_nullable 866 return idl_type.is_nullable and not idl_type.is_implicit_nullable
885 867
886 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 868 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
887 IdlUnionType.is_implicit_nullable = False 869 IdlUnionType.is_implicit_nullable = False
888 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 870 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698