| 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 23 matching lines...) Expand all Loading... |
| 34 class methods. | 34 class methods. |
| 35 | 35 |
| 36 Spec: | 36 Spec: |
| 37 http://www.w3.org/TR/WebIDL/#es-type-mapping | 37 http://www.w3.org/TR/WebIDL/#es-type-mapping |
| 38 | 38 |
| 39 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler | 39 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler |
| 40 """ | 40 """ |
| 41 | 41 |
| 42 import posixpath | 42 import posixpath |
| 43 | 43 |
| 44 from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType
, IdlNullableType | 44 from idl_types import IdlArrayOrSequenceType |
| 45 from idl_types import IdlNullableType |
| 46 from idl_types import IdlRecordType |
| 47 from idl_types import IdlType |
| 48 from idl_types import IdlTypeBase |
| 49 from idl_types import IdlUnionType |
| 45 import v8_attributes # for IdlType.constructor_type_name | 50 import v8_attributes # for IdlType.constructor_type_name |
| 46 from v8_globals import includes | 51 from v8_globals import includes |
| 47 from v8_utilities import extended_attribute_value_contains | 52 from v8_utilities import extended_attribute_value_contains |
| 48 | 53 |
| 49 | 54 |
| 50 ################################################################################ | 55 ################################################################################ |
| 51 # V8-specific handling of IDL types | 56 # V8-specific handling of IDL types |
| 52 ################################################################################ | 57 ################################################################################ |
| 53 | 58 |
| 54 NON_WRAPPER_TYPES = frozenset([ | 59 NON_WRAPPER_TYPES = frozenset([ |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 IdlType | 141 IdlType |
| 137 raw_type: | 142 raw_type: |
| 138 bool, True if idl_type's raw/primitive C++ type should be returned. | 143 bool, True if idl_type's raw/primitive C++ type should be returned. |
| 139 used_as_rvalue_type: | 144 used_as_rvalue_type: |
| 140 bool, True if the C++ type is used as an argument or the return | 145 bool, True if the C++ type is used as an argument or the return |
| 141 type of a method. | 146 type of a method. |
| 142 used_as_variadic_argument: | 147 used_as_variadic_argument: |
| 143 bool, True if the C++ type is used as a variadic argument of a metho
d. | 148 bool, True if the C++ type is used as a variadic argument of a metho
d. |
| 144 used_in_cpp_sequence: | 149 used_in_cpp_sequence: |
| 145 bool, True if the C++ type is used as an element of a container. | 150 bool, True if the C++ type is used as an element of a container. |
| 146 Containers can be an array, a sequence or a dictionary. | 151 Containers can be an array, a sequence, a dictionary or a record. |
| 147 """ | 152 """ |
| 148 def string_mode(): | 153 def string_mode(): |
| 149 if idl_type.is_nullable: | 154 if idl_type.is_nullable: |
| 150 return 'TreatNullAndUndefinedAsNullString' | 155 return 'TreatNullAndUndefinedAsNullString' |
| 151 if extended_attributes.get('TreatNullAs') == 'EmptyString': | 156 if extended_attributes.get('TreatNullAs') == 'EmptyString': |
| 152 return 'TreatNullAsEmptyString' | 157 return 'TreatNullAsEmptyString' |
| 153 if extended_attributes.get('TreatNullAs') == 'NullString': | 158 if extended_attributes.get('TreatNullAs') == 'NullString': |
| 154 return 'TreatNullAsNullString' | 159 return 'TreatNullAsNullString' |
| 155 return '' | 160 return '' |
| 156 | 161 |
| 157 extended_attributes = extended_attributes or {} | 162 extended_attributes = extended_attributes or {} |
| 158 idl_type = idl_type.preprocessed_type | 163 idl_type = idl_type.preprocessed_type |
| 159 | 164 |
| 160 # Array or sequence types | 165 # Array or sequence types |
| 161 if used_as_variadic_argument: | 166 if used_as_variadic_argument: |
| 162 native_array_element_type = idl_type | 167 native_array_element_type = idl_type |
| 163 else: | 168 else: |
| 164 native_array_element_type = idl_type.native_array_element_type | 169 native_array_element_type = idl_type.native_array_element_type |
| 165 if native_array_element_type: | 170 if native_array_element_type: |
| 166 vector_type = cpp_ptr_type('Vector', 'HeapVector', native_array_element_
type.is_gc_type) | 171 vector_type = cpp_ptr_type('Vector', 'HeapVector', native_array_element_
type.is_gc_type) |
| 167 vector_template_type = cpp_template_type(vector_type, native_array_eleme
nt_type.cpp_type_args(used_in_cpp_sequence=True)) | 172 vector_template_type = cpp_template_type(vector_type, native_array_eleme
nt_type.cpp_type_args(used_in_cpp_sequence=True)) |
| 168 if used_as_rvalue_type: | 173 if used_as_rvalue_type: |
| 169 return 'const %s&' % vector_template_type | 174 return 'const %s&' % vector_template_type |
| 170 return vector_template_type | 175 return vector_template_type |
| 171 | 176 |
| 177 # Record types. |
| 178 if idl_type.is_record_type: |
| 179 vector_type = cpp_ptr_type('Vector', 'HeapVector', idl_type.value_type.i
s_gc_type) |
| 180 value_type = idl_type.value_type.cpp_type_args(used_in_cpp_sequence=True
) |
| 181 vector_template_type = cpp_template_type(vector_type, |
| 182 'std::pair<String, %s>' % value
_type) |
| 183 if used_as_rvalue_type: |
| 184 return 'const %s&' % vector_template_type |
| 185 return vector_template_type |
| 186 |
| 172 # Simple types | 187 # Simple types |
| 173 base_idl_type = idl_type.base_type | 188 base_idl_type = idl_type.base_type |
| 174 | 189 |
| 175 if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: | 190 if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: |
| 176 return base_idl_type | 191 return base_idl_type |
| 177 if base_idl_type in CPP_INT_TYPES: | 192 if base_idl_type in CPP_INT_TYPES: |
| 178 return 'int' | 193 return 'int' |
| 179 if base_idl_type in CPP_UNSIGNED_TYPES: | 194 if base_idl_type in CPP_UNSIGNED_TYPES: |
| 180 return 'unsigned' | 195 return 'unsigned' |
| 181 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: | 196 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 IdlTypeBase.is_gc_type = property(is_gc_type) | 330 IdlTypeBase.is_gc_type = property(is_gc_type) |
| 316 | 331 |
| 317 | 332 |
| 318 def is_traceable(idl_type): | 333 def is_traceable(idl_type): |
| 319 return (idl_type.is_garbage_collected or idl_type.is_dictionary) | 334 return (idl_type.is_garbage_collected or idl_type.is_dictionary) |
| 320 | 335 |
| 321 IdlTypeBase.is_traceable = property(is_traceable) | 336 IdlTypeBase.is_traceable = property(is_traceable) |
| 322 IdlUnionType.is_traceable = property(lambda self: True) | 337 IdlUnionType.is_traceable = property(lambda self: True) |
| 323 IdlArrayOrSequenceType.is_traceable = property( | 338 IdlArrayOrSequenceType.is_traceable = property( |
| 324 lambda self: self.element_type.is_traceable) | 339 lambda self: self.element_type.is_traceable) |
| 340 IdlRecordType.is_traceable = property( |
| 341 lambda self: self.value_type.is_traceable) |
| 325 | 342 |
| 326 | 343 |
| 327 ################################################################################ | 344 ################################################################################ |
| 328 # Includes | 345 # Includes |
| 329 ################################################################################ | 346 ################################################################################ |
| 330 | 347 |
| 331 def includes_for_cpp_class(class_name, relative_dir_posix): | 348 def includes_for_cpp_class(class_name, relative_dir_posix): |
| 332 return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
)]) | 349 return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
)]) |
| 333 | 350 |
| 334 | 351 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 421 |
| 405 IdlUnionType.includes_for_type = includes_for_union_type | 422 IdlUnionType.includes_for_type = includes_for_union_type |
| 406 | 423 |
| 407 | 424 |
| 408 def includes_for_array_or_sequence_type(idl_type, extended_attributes=None): | 425 def includes_for_array_or_sequence_type(idl_type, extended_attributes=None): |
| 409 return idl_type.element_type.includes_for_type(extended_attributes) | 426 return idl_type.element_type.includes_for_type(extended_attributes) |
| 410 | 427 |
| 411 IdlArrayOrSequenceType.includes_for_type = includes_for_array_or_sequence_type | 428 IdlArrayOrSequenceType.includes_for_type = includes_for_array_or_sequence_type |
| 412 | 429 |
| 413 | 430 |
| 431 def includes_for_record_type(idl_type, extended_attributes=None): |
| 432 return set.union(set(['bindings/core/v8/IDLTypes.h']), |
| 433 idl_type.key_type.includes_for_type(extended_attributes), |
| 434 idl_type.value_type.includes_for_type(extended_attributes)) |
| 435 |
| 436 IdlRecordType.includes_for_type = includes_for_record_type |
| 437 |
| 438 |
| 414 def add_includes_for_type(idl_type, extended_attributes=None): | 439 def add_includes_for_type(idl_type, extended_attributes=None): |
| 415 includes.update(idl_type.includes_for_type(extended_attributes)) | 440 includes.update(idl_type.includes_for_type(extended_attributes)) |
| 416 | 441 |
| 417 IdlTypeBase.add_includes_for_type = add_includes_for_type | 442 IdlTypeBase.add_includes_for_type = add_includes_for_type |
| 418 | 443 |
| 419 | 444 |
| 420 def includes_for_interface(interface_name): | 445 def includes_for_interface(interface_name): |
| 421 return IdlType(interface_name).includes_for_type() | 446 return IdlType(interface_name).includes_for_type() |
| 422 | 447 |
| 423 | 448 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 540 |
| 516 | 541 |
| 517 def v8_conversion_needs_exception_state(idl_type): | 542 def v8_conversion_needs_exception_state(idl_type): |
| 518 return (idl_type.is_numeric_type or | 543 return (idl_type.is_numeric_type or |
| 519 idl_type.is_enum or | 544 idl_type.is_enum or |
| 520 idl_type.is_dictionary or | 545 idl_type.is_dictionary or |
| 521 idl_type.name in ('Boolean', 'ByteString', 'Date', 'Dictionary', 'US
VString', 'SerializedScriptValue')) | 546 idl_type.name in ('Boolean', 'ByteString', 'Date', 'Dictionary', 'US
VString', 'SerializedScriptValue')) |
| 522 | 547 |
| 523 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep
tion_state) | 548 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep
tion_state) |
| 524 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True | 549 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True |
| 550 IdlRecordType.v8_conversion_needs_exception_state = True |
| 525 IdlUnionType.v8_conversion_needs_exception_state = True | 551 IdlUnionType.v8_conversion_needs_exception_state = True |
| 526 | 552 |
| 527 | 553 |
| 528 TRIVIAL_CONVERSIONS = frozenset([ | 554 TRIVIAL_CONVERSIONS = frozenset([ |
| 529 'any', | 555 'any', |
| 530 'boolean', | 556 'boolean', |
| 531 'Date', | 557 'Date', |
| 532 'Dictionary', | 558 'Dictionary', |
| 533 'NodeFilter', | 559 'NodeFilter', |
| 534 'XPathNSResolver', | 560 'XPathNSResolver', |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 elif idl_type.v8_conversion_needs_exception_state: | 599 elif idl_type.v8_conversion_needs_exception_state: |
| 574 arguments = ', '.join([v8_value, 'exceptionState']) | 600 arguments = ', '.join([v8_value, 'exceptionState']) |
| 575 else: | 601 else: |
| 576 arguments = v8_value | 602 arguments = v8_value |
| 577 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 603 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
| 578 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 604 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
| 579 elif idl_type.is_array_buffer_or_view: | 605 elif idl_type.is_array_buffer_or_view: |
| 580 cpp_expression_format = ( | 606 cpp_expression_format = ( |
| 581 '{v8_value}->Is{idl_type}() ? ' | 607 '{v8_value}->Is{idl_type}() ? ' |
| 582 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') | 608 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') |
| 609 elif idl_type.is_record_type: |
| 610 # This function is not record-specific, but for now we are using |
| 611 # NativeValueTraits<> and the idl:: types only with this IDL type. |
| 612 def idl_type_name(idl_type): |
| 613 idl_type = idl_type.preprocessed_type |
| 614 if idl_type.native_array_element_type: |
| 615 return 'idl::Sequence<%s>' % idl_type_name(idl_type.native_array
_element_type) |
| 616 elif idl_type.is_record_type: |
| 617 return 'idl::Record<%s, %s>' % (idl_type_name(idl_type.key_type)
, |
| 618 idl_type_name(idl_type.value_typ
e)) |
| 619 elif idl_type.is_union_type: |
| 620 return idl_type.as_union_type.name |
| 621 elif idl_type.is_basic_type or idl_type.name == 'Promise': |
| 622 return 'idl::%s' % idl_type.name |
| 623 elif idl_type.implemented_as is not None: |
| 624 return idl_type.implemented_as |
| 625 return idl_type.name |
| 626 |
| 627 if idl_type.is_nullable: |
| 628 type_name = idl_type.inner_type.name |
| 629 else: |
| 630 type_name = idl_type.name |
| 631 |
| 632 k = idl_type_name(idl_type.key_type) |
| 633 v = idl_type_name(idl_type.value_type) |
| 634 |
| 635 cpp_expression_format = ( |
| 636 'NativeValueTraits<idl::Record<%s, %s>>::nativeValue({isolate}, {v8_
value}, exceptionState)' % (k, v)) |
| 583 elif idl_type.is_union_type: | 637 elif idl_type.is_union_type: |
| 584 nullable = 'UnionTypeConversionMode::Nullable' if idl_type.includes_null
able_type else 'UnionTypeConversionMode::NotNullable' | 638 nullable = 'UnionTypeConversionMode::Nullable' if idl_type.includes_null
able_type else 'UnionTypeConversionMode::NotNullable' |
| 585 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, %s, exceptionState)' % nullable | 639 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, %s, exceptionState)' % nullable |
| 586 elif idl_type.use_output_parameter_for_result: | 640 elif idl_type.use_output_parameter_for_result: |
| 587 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, exceptionState)' | 641 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, exceptionState)' |
| 588 elif idl_type.is_callback_function: | 642 elif idl_type.is_callback_function: |
| 589 cpp_expression_format = ( | 643 cpp_expression_format = ( |
| 590 '{idl_type}::create(ScriptState::current({isolate}), {v8_value})') | 644 '{idl_type}::create(ScriptState::current({isolate}), {v8_value})') |
| 591 else: | 645 else: |
| 592 cpp_expression_format = ( | 646 cpp_expression_format = ( |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 return 'NullableDictionary' | 806 return 'NullableDictionary' |
| 753 | 807 |
| 754 if idl_type.is_dictionary or idl_type.is_union_type: | 808 if idl_type.is_dictionary or idl_type.is_union_type: |
| 755 return 'DictionaryOrUnion' | 809 return 'DictionaryOrUnion' |
| 756 | 810 |
| 757 # Array or sequence types | 811 # Array or sequence types |
| 758 native_array_element_type = idl_type.native_array_element_type | 812 native_array_element_type = idl_type.native_array_element_type |
| 759 if native_array_element_type: | 813 if native_array_element_type: |
| 760 return 'FrozenArray' if idl_type.is_frozen_array else 'array' | 814 return 'FrozenArray' if idl_type.is_frozen_array else 'array' |
| 761 | 815 |
| 816 # Record types. |
| 817 if idl_type.is_record_type: |
| 818 return 'Record' |
| 819 |
| 762 # Simple types | 820 # Simple types |
| 763 base_idl_type = idl_type.base_type | 821 base_idl_type = idl_type.base_type |
| 764 # Basic types, without additional includes | 822 # Basic types, without additional includes |
| 765 if base_idl_type in CPP_INT_TYPES: | 823 if base_idl_type in CPP_INT_TYPES: |
| 766 return 'int' | 824 return 'int' |
| 767 if base_idl_type in CPP_UNSIGNED_TYPES: | 825 if base_idl_type in CPP_UNSIGNED_TYPES: |
| 768 return 'unsigned' | 826 return 'unsigned' |
| 769 if idl_type.is_string_type: | 827 if idl_type.is_string_type: |
| 770 if idl_type.is_nullable: | 828 if idl_type.is_nullable: |
| 771 return 'StringOrNull' | 829 return 'StringOrNull' |
| (...skipping 29 matching lines...) Expand all Loading... |
| 801 'double': 'v8SetReturnValue(info, {cpp_value})', | 859 'double': 'v8SetReturnValue(info, {cpp_value})', |
| 802 'unrestricted double': 'v8SetReturnValue(info, {cpp_value})', | 860 'unrestricted double': 'v8SetReturnValue(info, {cpp_value})', |
| 803 # No special v8SetReturnValue* function, but instead convert value to V8 | 861 # No special v8SetReturnValue* function, but instead convert value to V8 |
| 804 # and then use general v8SetReturnValue. | 862 # and then use general v8SetReturnValue. |
| 805 'array': 'v8SetReturnValue(info, {cpp_value})', | 863 'array': 'v8SetReturnValue(info, {cpp_value})', |
| 806 'FrozenArray': 'v8SetReturnValue(info, {cpp_value})', | 864 'FrozenArray': 'v8SetReturnValue(info, {cpp_value})', |
| 807 'Date': 'v8SetReturnValue(info, {cpp_value})', | 865 'Date': 'v8SetReturnValue(info, {cpp_value})', |
| 808 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', | 866 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', |
| 809 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 867 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 810 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 868 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 869 # Records. |
| 870 'Record': 'v8SetReturnValue(info, ToV8({cpp_value}, info.Holder(), info.GetI
solate()))', |
| 811 # DOMWrapper | 871 # DOMWrapper |
| 812 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, {cpp_value})', | 872 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, {cpp_value})', |
| 813 'DOMWrapperFast': 'v8SetReturnValueFast(info, {cpp_value}, {script_wrappable
})', | 873 'DOMWrapperFast': 'v8SetReturnValueFast(info, {cpp_value}, {script_wrappable
})', |
| 814 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', | 874 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', |
| 815 # If [CheckSecurity=ReturnValue] is specified, the returned object must be | 875 # If [CheckSecurity=ReturnValue] is specified, the returned object must be |
| 816 # wrapped in its own realm, which can be different from the realm of the | 876 # wrapped in its own realm, which can be different from the realm of the |
| 817 # receiver object. | 877 # receiver object. |
| 818 # | 878 # |
| 819 # [CheckSecurity=ReturnValue] is used only for contentDocument and | 879 # [CheckSecurity=ReturnValue] is used only for contentDocument and |
| 820 # getSVGDocument attributes of HTML{IFrame,Frame,Object,Embed}Element, | 880 # getSVGDocument attributes of HTML{IFrame,Frame,Object,Embed}Element, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})', | 955 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})', |
| 896 'void': 'v8Undefined()', | 956 'void': 'v8Undefined()', |
| 897 'StringOrNull': '{cpp_value}.isNull() ? v8::Local<v8::Value>(v8::Null({isola
te})) : v8String({isolate}, {cpp_value})', | 957 'StringOrNull': '{cpp_value}.isNull() ? v8::Local<v8::Value>(v8::Null({isola
te})) : v8String({isolate}, {cpp_value})', |
| 898 # Special cases | 958 # Special cases |
| 899 'Dictionary': '{cpp_value}.v8Value()', | 959 'Dictionary': '{cpp_value}.v8Value()', |
| 900 'EventHandler': ( | 960 'EventHandler': ( |
| 901 '{cpp_value} ? ' + | 961 '{cpp_value} ? ' + |
| 902 'V8AbstractEventListener::cast({cpp_value})->getListenerOrNull(' + | 962 'V8AbstractEventListener::cast({cpp_value})->getListenerOrNull(' + |
| 903 '{isolate}, impl->getExecutionContext()) : ' + | 963 '{isolate}, impl->getExecutionContext()) : ' + |
| 904 'v8::Null({isolate}).As<v8::Value>()'), | 964 'v8::Null({isolate}).As<v8::Value>()'), |
| 965 'Record': 'ToV8({cpp_value}, {creation_context}, {isolate})', |
| 905 'ScriptValue': '{cpp_value}.v8Value()', | 966 'ScriptValue': '{cpp_value}.v8Value()', |
| 906 'SerializedScriptValue': 'v8Deserialize({isolate}, {cpp_value})', | 967 'SerializedScriptValue': 'v8Deserialize({isolate}, {cpp_value})', |
| 907 # General | 968 # General |
| 908 'array': 'ToV8({cpp_value}, {creation_context}, {isolate})', | 969 'array': 'ToV8({cpp_value}, {creation_context}, {isolate})', |
| 909 'FrozenArray': 'freezeV8Object(ToV8({cpp_value}, {creation_context}, {isolat
e}), {isolate})', | 970 'FrozenArray': 'freezeV8Object(ToV8({cpp_value}, {creation_context}, {isolat
e}), {isolate})', |
| 910 'DOMWrapper': 'ToV8({cpp_value}, {creation_context}, {isolate})', | 971 'DOMWrapper': 'ToV8({cpp_value}, {creation_context}, {isolate})', |
| 911 # Passing nullable dictionaries isn't a pattern currently used | 972 # Passing nullable dictionaries isn't a pattern currently used |
| 912 # anywhere in the web platform, and more work would be needed in | 973 # anywhere in the web platform, and more work would be needed in |
| 913 # the code generator to distinguish between passing null, and | 974 # the code generator to distinguish between passing null, and |
| 914 # passing an object which happened to not contain any of the | 975 # passing an object which happened to not contain any of the |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 number_of_nullable_member_types_union) | 1089 number_of_nullable_member_types_union) |
| 1029 | 1090 |
| 1030 | 1091 |
| 1031 def includes_nullable_type_union(idl_type): | 1092 def includes_nullable_type_union(idl_type): |
| 1032 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 1093 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 1033 return idl_type.number_of_nullable_member_types == 1 | 1094 return idl_type.number_of_nullable_member_types == 1 |
| 1034 | 1095 |
| 1035 IdlTypeBase.includes_nullable_type = False | 1096 IdlTypeBase.includes_nullable_type = False |
| 1036 IdlNullableType.includes_nullable_type = True | 1097 IdlNullableType.includes_nullable_type = True |
| 1037 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 1098 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |