Index: Source/bindings/scripts/v8_types.py |
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py |
index 57b79d40e86f7ff9dc065e927e7f466b59d84ff2..d225d5b1d570cd7a6820d98558c48639db4b8462 100644 |
--- a/Source/bindings/scripts/v8_types.py |
+++ b/Source/bindings/scripts/v8_types.py |
@@ -694,3 +694,14 @@ def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea |
return statement |
IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value |
+ |
+ |
+def literal_cpp_value(idl_type, idl_literal): |
+ """Converts an expression that is a valid C++ literal for this type.""" |
+ # FIXME: add validation that idl_type and idl_literal are compatible |
+ literal_value = str(idl_literal) |
+ if idl_type.base_type in CPP_UNSIGNED_TYPES: |
+ return literal_value + 'u' |
+ return literal_value |
+ |
+IdlType.literal_cpp_value = literal_cpp_value |