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

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

Issue 474323002: IDL: initialize union member variables (to null/zero) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/methods.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 ce2e63a89da0fe4819236413c0e1a9bd4f1230a4..5f930d324866e2c464a5fc00dbfe2af65cc1d62c 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -203,11 +203,21 @@ def cpp_type_initializer(idl_type):
|idl_type| argument is of type IdlType.
"""
- if (idl_type.is_numeric_type):
+ base_idl_type = idl_type.base_type
+
+ if idl_type.native_array_element_type:
+ return ''
+ if idl_type.is_numeric_type:
return ' = 0'
- if idl_type.base_type == 'boolean':
+ if base_idl_type == 'boolean':
return ' = false'
- return ''
+ if (base_idl_type in NON_WRAPPER_TYPES or
+ base_idl_type in CPP_SPECIAL_CONVERSION_RULES or
+ base_idl_type == 'any' or
+ idl_type.is_string_type or
+ idl_type.is_enum):
+ return ''
+ return ' = nullptr'
def cpp_type_union(idl_type, extended_attributes=None, raw_type=False):
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698