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

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

Issue 472803002: IDL: Clean-up "should use Nullable<>" logic a little (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-extend-IdlTypeBase
Patch Set: 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 | « no previous file | no next file » | 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 0ad036b7350ea27008f57eff9eee2a7c7c94fd21..46f2553c952698edb5fc27e5c47a89e166603da5 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -396,7 +396,7 @@ def add_includes_for_interface(interface_name):
def impl_should_use_nullable_container(idl_type):
- return idl_type.native_array_element_type or idl_type.is_primitive_type
+ return not(idl_type.cpp_type_has_null_value)
IdlTypeBase.impl_should_use_nullable_container = property(
impl_should_use_nullable_container)
@@ -790,15 +790,20 @@ IdlType.literal_cpp_value = literal_cpp_value
################################################################################
-def is_implicit_nullable(idl_type):
- # Nullable type where the corresponding C++ type supports a null value.
+def cpp_type_has_null_value(idl_type):
# - String types (String/AtomicString) represent null as a null string,
# i.e. one for which String::isNull() returns true.
# - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as
# a null pointer.
- return idl_type.is_nullable and (
- (idl_type.is_string_type or idl_type.is_wrapper_type) and
- not idl_type.native_array_element_type)
+ return ((idl_type.is_string_type or idl_type.is_wrapper_type) and
+ not idl_type.native_array_element_type)
+
+IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value)
+
+
+def is_implicit_nullable(idl_type):
+ # Nullable type where the corresponding C++ type supports a null value.
+ return idl_type.is_nullable and idl_type.cpp_type_has_null_value
def is_explicit_nullable(idl_type):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698