Index: Source/bindings/scripts/v8_types.py |
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py |
index 466ab25e05ffe2237fc380efa6eff1c10e11ae9b..aee9e1abc42939d6e669eddb97e70af871d3428c 100644 |
--- a/Source/bindings/scripts/v8_types.py |
+++ b/Source/bindings/scripts/v8_types.py |
@@ -431,13 +431,13 @@ def v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, in |
return expression |
-def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None): |
+def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True): |
"""Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" |
this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, used_as_argument=True) |
idl_type = idl_type.preprocessed_type |
cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index) |
- args = [this_cpp_type, variable_name, cpp_value] |
+ args = [variable_name, cpp_value] |
if idl_type.base_type == 'DOMString' and not idl_type.array_or_sequence_type: |
macro = 'TOSTRING_VOID' |
elif idl_type.is_integer_type: |
@@ -446,6 +446,12 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl |
else: |
macro = 'TONATIVE_VOID' |
+ if declare_variable: |
+ args.insert(0, this_cpp_type) |
+ else: |
+ # Use a macro that assumes a previously declared local variable. |
+ macro += '_NO_DECL' |
+ |
return '%s(%s)' % (macro, ', '.join(args)) |
IdlType.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value |