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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_dictionary.py

Issue 2494973002: bindings: Stop using Nullable<T> in dictionary impl (Closed)
Patch Set: Comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
index 4bdb8fd2a51f1bf1f0c95617fa749c0b59bcb804..e15f60fd1fc55112932437faa5a18558dfe10ecd 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
@@ -188,13 +188,14 @@ def member_impl_context(member, interfaces_info, header_includes):
idl_type = unwrap_nullable_if_needed(member.idl_type)
cpp_name = v8_utilities.cpp_name(member)
- def getter_expression():
- if idl_type.impl_should_use_nullable_container:
- return 'm_%s.get()' % cpp_name
- return 'm_%s' % cpp_name
+ nullable_indicator_name = None
+ if not idl_type.cpp_type_has_null_value:
+ nullable_indicator_name = 'm_has' + cpp_name[0].upper() + cpp_name[1:]
def has_method_expression():
- if idl_type.impl_should_use_nullable_container or idl_type.is_enum or idl_type.is_string_type or idl_type.is_union_type:
+ if nullable_indicator_name:
+ return nullable_indicator_name
+ elif idl_type.is_enum or idl_type.is_string_type or idl_type.is_union_type:
return '!m_%s.isNull()' % cpp_name
elif idl_type.name in ['Any', 'Object']:
return '!(m_{0}.isEmpty() || m_{0}.isNull() || m_{0}.isUndefined())'.format(cpp_name)
@@ -203,12 +204,6 @@ def member_impl_context(member, interfaces_info, header_includes):
else:
return 'm_%s' % cpp_name
- def member_cpp_type():
- member_cpp_type = idl_type.cpp_type_args(used_in_cpp_sequence=True)
- if idl_type.impl_should_use_nullable_container:
- return v8_types.cpp_template_type('Nullable', member_cpp_type)
- return member_cpp_type
-
cpp_default_value = None
if member.default_value and not member.default_value.is_null:
cpp_default_value = idl_type.literal_cpp_value(member.default_value)
@@ -217,13 +212,14 @@ def member_impl_context(member, interfaces_info, header_includes):
return {
'cpp_default_value': cpp_default_value,
'cpp_name': cpp_name,
- 'getter_expression': getter_expression(),
+ 'getter_expression': 'm_' + cpp_name,
'has_method_expression': has_method_expression(),
'has_method_name': has_method_name_for_dictionary_member(member),
'is_nullable': idl_type.is_nullable,
'is_traceable': idl_type.is_traceable,
- 'member_cpp_type': member_cpp_type(),
+ 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True),
'null_setter_name': null_setter_name_for_dictionary_member(member),
+ 'nullable_indicator_name': nullable_indicator_name,
'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
'setter_name': setter_name_for_dictionary_member(member),
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698