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

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

Issue 567503002: Add toDouble() helper, and use toFloat()/toDouble() for conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index fd45dddb2564a80b240e5e9e561d8d58b97cd434..746bf9c15d680356c88b8995b056cb81fce76e99 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -448,10 +448,10 @@ V8_VALUE_TO_CPP_VALUE = {
'ByteString': 'toByteString({arguments})',
'ScalarValueString': 'toScalarValueString({arguments})',
'boolean': '{v8_value}->BooleanValue()',
- 'float': 'static_cast<float>({v8_value}->NumberValue())',
- 'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())',
- 'double': 'static_cast<double>({v8_value}->NumberValue())',
- 'unrestricted double': 'static_cast<double>({v8_value}->NumberValue())',
+ 'float': 'toFloat({arguments})',
+ 'unrestricted float': 'toFloat({arguments})',
+ 'double': 'toDouble({arguments})',
+ 'unrestricted double': 'toDouble({arguments})',
'byte': 'toInt8({arguments})',
'octet': 'toUInt8({arguments})',
'short': 'toInt16({arguments})',
@@ -474,7 +474,7 @@ V8_VALUE_TO_CPP_VALUE = {
def v8_conversion_needs_exception_state(idl_type):
- return (idl_type.is_integer_type or
+ return (idl_type.is_numeric_type or
idl_type.is_dictionary or
idl_type.name in ('ByteString', 'ScalarValueString'))

Powered by Google App Engine
This is Rietveld 408576698