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..8e124183373346e37753906ba74788e3e19850c9 100644 |
--- a/Source/bindings/scripts/v8_types.py |
+++ b/Source/bindings/scripts/v8_types.py |
@@ -120,6 +120,25 @@ CPP_SPECIAL_CONVERSION_RULES = { |
} |
+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. |
+ """ |
+ |
+ cpp_type = str(idl_type.cpp_type) |
+ |
+ if (idl_type.base_type in (CPP_TYPE_SAME_AS_IDL_TYPE | CPP_INT_TYPES | CPP_UNSIGNED_TYPES) or |
+ cpp_type in ('float', 'double') or |
haraken
2014/07/16 00:54:02
Can't we use idl_type.is_numeric_type() ?
Mostyn Bramley-Moore
2014/07/16 07:15:20
Done.
|
+ cpp_type.endswith('*')): |
haraken
2014/07/16 00:54:02
Can this happen?
Actually we don't want to mix id
Jens Widell
2014/07/16 07:00:53
This is copied from my patch (which is unpolished)
Mostyn Bramley-Moore
2014/07/16 07:15:20
Done.
|
+ return ' = 0' |
+ if cpp_type == 'bool': |
haraken
2014/07/16 00:54:02
idl_type.base_type == 'boolean'
Mostyn Bramley-Moore
2014/07/16 07:15:20
Done.
|
+ return ' = false' |
+ if cpp_type == 'String': |
+ return ' = ""' |
haraken
2014/07/16 00:54:02
We shouldn't add this. A String should be initiali
Mostyn Bramley-Moore
2014/07/16 07:15:20
Done.
|
+ return '' |
+ |
def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argument=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): |
"""Returns C++ type corresponding to IDL type. |