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

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

Issue 352133002: IDL: fix handling of non-decimal and unsigned default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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/tests/idls/TestObject.idl » ('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 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
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698