| Index: Source/bindings/scripts/v8_types.py
|
| diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
|
| index 5d599ab428dddef3676a84cbb6d983f34792fac0..d5cda69ea556d461f563881bc21a066c4f2289cc 100644
|
| --- a/Source/bindings/scripts/v8_types.py
|
| +++ b/Source/bindings/scripts/v8_types.py
|
| @@ -39,7 +39,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
|
|
|
| import posixpath
|
|
|
| -from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType
|
| +from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType, IdlNullableType
|
| import v8_attributes # for IdlType.constructor_type_name
|
| from v8_globals import includes
|
|
|
| @@ -75,12 +75,16 @@ TYPED_ARRAYS = {
|
| IdlTypeBase.is_typed_array_element_type = False
|
| IdlType.is_typed_array_element_type = property(
|
| lambda self: self.base_type in TYPED_ARRAYS)
|
| +IdlNullableType.is_typed_array_element_type = property(
|
| + lambda self: self.inner_type.is_typed_array_element_type)
|
|
|
|
|
| IdlTypeBase.is_wrapper_type = False
|
| IdlType.is_wrapper_type = property(
|
| lambda self: (self.is_interface_type and
|
| self.base_type not in NON_WRAPPER_TYPES))
|
| +IdlNullableType.is_wrapper_type = property(
|
| + lambda self: self.inner_type.is_wrapper_type)
|
|
|
|
|
| ################################################################################
|
| @@ -230,6 +234,8 @@ IdlUnionType.cpp_type_args = cpp_type_union
|
| IdlTypeBase.native_array_element_type = None
|
| IdlArrayOrSequenceType.native_array_element_type = property(
|
| lambda self: self.element_type)
|
| +IdlNullableType.native_array_element_type = property(
|
| + lambda self: self.inner_type.native_array_element_type)
|
|
|
|
|
| def cpp_template_type(template, inner_type):
|
| @@ -273,7 +279,7 @@ def implemented_as(idl_type):
|
| return base_idl_type
|
|
|
|
|
| -IdlType.implemented_as = property(implemented_as)
|
| +IdlTypeBase.implemented_as = property(implemented_as)
|
|
|
| IdlType.set_implemented_as_interfaces = classmethod(
|
| lambda cls, new_implemented_as_interfaces:
|
| @@ -283,8 +289,7 @@ IdlType.set_implemented_as_interfaces = classmethod(
|
| # [GarbageCollected]
|
| IdlType.garbage_collected_types = set()
|
|
|
| -IdlTypeBase.is_garbage_collected = False
|
| -IdlType.is_garbage_collected = property(
|
| +IdlTypeBase.is_garbage_collected = property(
|
| lambda self: self.base_type in IdlType.garbage_collected_types)
|
|
|
| IdlType.set_garbage_collected_types = classmethod(
|
| @@ -295,8 +300,7 @@ IdlType.set_garbage_collected_types = classmethod(
|
| # [WillBeGarbageCollected]
|
| IdlType.will_be_garbage_collected_types = set()
|
|
|
| -IdlTypeBase.is_will_be_garbage_collected = False
|
| -IdlType.is_will_be_garbage_collected = property(
|
| +IdlTypeBase.is_will_be_garbage_collected = property(
|
| lambda self: self.base_type in IdlType.will_be_garbage_collected_types)
|
|
|
| IdlType.set_will_be_garbage_collected_types = classmethod(
|
| @@ -381,6 +385,8 @@ IdlUnionType.includes_for_type = property(
|
| for member_type in self.member_types]))
|
| IdlArrayOrSequenceType.includes_for_type = property(
|
| lambda self: self.element_type.includes_for_type)
|
| +IdlNullableType.includes_for_type = property(
|
| + lambda self: self.inner_type.includes_for_type)
|
|
|
|
|
| def add_includes_for_type(idl_type):
|
| @@ -593,7 +599,10 @@ def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
|
| if idl_type.base_type in ['long long', 'unsigned long long']:
|
| # long long and unsigned long long are not representable in ECMAScript;
|
| # we represent them as doubles.
|
| - idl_type = IdlType('double', is_nullable=idl_type.is_nullable)
|
| + is_nullable = idl_type.is_nullable
|
| + idl_type = IdlType('double')
|
| + if is_nullable:
|
| + idl_type = IdlNullableType(idl_type)
|
| cpp_value = 'static_cast<double>(%s)' % cpp_value
|
| # HTML5 says that unsigned reflected attributes should be in the range
|
| # [0, 2^31). When a value isn't in this range, a default value (or 0)
|
| @@ -735,7 +744,7 @@ def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, scr
|
| IdlTypeBase.v8_set_return_value = v8_set_return_value
|
| IdlUnionType.v8_set_return_value = v8_set_return_value_union
|
|
|
| -IdlType.release = property(lambda self: self.is_interface_type)
|
| +IdlTypeBase.release = property(lambda self: self.is_interface_type)
|
| IdlUnionType.release = property(
|
| lambda self: [member_type.is_interface_type
|
| for member_type in self.member_types])
|
| @@ -789,7 +798,7 @@ def literal_cpp_value(idl_type, idl_literal):
|
| return literal_value + 'u'
|
| return literal_value
|
|
|
| -IdlType.literal_cpp_value = literal_cpp_value
|
| +IdlTypeBase.literal_cpp_value = literal_cpp_value
|
|
|
|
|
| ################################################################################
|
|
|