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

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

Issue 390223004: initialize result variables in v8 bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixups for jens Created 6 years, 5 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/attributes.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 7ad89b54b406ac6d9f16c728b82f35cccbc84d7c..0a070f8074c00ca2bed6b7a4c1d70b52bf6b4bee 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -190,13 +190,33 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen
return base_idl_type + '*'
+def cpp_type_initializer(idl_type):
+ """Returns a string containing a C++ initialization statement for the
+ corresponding type.
+
+ |idl_type| argument is of type IdlType.
+ """
+
+ if (idl_type.is_numeric_type):
+ return ' = 0'
+ if idl_type.base_type == 'boolean':
+ return ' = false'
+ return ''
+
+
def cpp_type_union(idl_type, extended_attributes=None, raw_type=False):
return (member_type.cpp_type for member_type in idl_type.member_types)
+def cpp_type_initializer_union(idl_type):
+ return (member_type.cpp_type_initializer for member_type in idl_type.member_types)
+
+
# Allow access as idl_type.cpp_type if no arguments
IdlType.cpp_type = property(cpp_type)
+IdlType.cpp_type_initializer = property(cpp_type_initializer)
IdlUnionType.cpp_type = property(cpp_type_union)
+IdlUnionType.cpp_type_initializer = property(cpp_type_initializer_union)
IdlType.cpp_type_args = cpp_type
IdlUnionType.cpp_type_args = cpp_type_union
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698