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

Unified Diff: Source/bindings/scripts/v8_types.py

Issue 474173002: IDL: Use IdlNullableType wrapper to represent nullable types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 5f930d324866e2c464a5fc00dbfe2af65cc1d62c..569cac22c7306aa96dba3791a0057bcfa5320845 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
@@ -72,12 +72,9 @@ TYPED_ARRAYS = {
'Uint32Array': ('unsigned int', 'v8::kExternalUnsignedIntArray'),
}
-IdlTypeBase.is_typed_array_element_type = False
IdlType.is_typed_array_element_type = property(
lambda self: self.base_type in TYPED_ARRAYS)
-
-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))
@@ -239,7 +236,6 @@ IdlUnionType.cpp_type_initializer = property(cpp_type_initializer_union)
IdlUnionType.cpp_type_args = cpp_type_union
-IdlTypeBase.native_array_element_type = None
IdlArrayOrSequenceType.native_array_element_type = property(
lambda self: self.element_type)
@@ -295,7 +291,6 @@ IdlType.set_implemented_as_interfaces = classmethod(
# [GarbageCollected]
IdlType.garbage_collected_types = set()
-IdlTypeBase.is_garbage_collected = False
IdlType.is_garbage_collected = property(
lambda self: self.base_type in IdlType.garbage_collected_types)
@@ -307,7 +302,6 @@ 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(
lambda self: self.base_type in IdlType.will_be_garbage_collected_types)
@@ -605,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)
@@ -742,7 +739,6 @@ IdlType.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])
-IdlArrayOrSequenceType.release = False
CPP_VALUE_TO_V8_VALUE = {
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698