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

Unified Diff: Source/bindings/scripts/v8_methods.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/idl_definitions.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index e6bef2c0abf173263d7a3b64bd4d1c5b8638f09c..0deeabed05c2d14dfdaff6e248ce27c33236c2b7 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -33,6 +33,7 @@ Extends IdlType and IdlUnionType with property |union_arguments|.
Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
"""
+from idl_definitions import IdlArgument
from idl_types import IdlType, IdlUnionType, inherits_interface
from v8_globals import includes
import v8_types
@@ -178,7 +179,7 @@ def argument_context(interface, method, argument, index):
used_as_variadic_argument=argument.is_variadic),
'cpp_value': this_cpp_value,
# FIXME: check that the default value's type is compatible with the argument's
- 'default_value': str(argument.default_value) if argument.default_value else None,
+ 'default_value': argument.default_cpp_value,
'enum_validation_expression': idl_type.enum_validation_expression,
# FIXME: remove once [Default] removed and just use argument.default_value
'has_default': 'Default' in extended_attributes or argument.default_value,
@@ -328,5 +329,12 @@ def union_arguments(idl_type):
for i in range(len(idl_type.member_types))
for arg in ['result%sEnabled' % i, 'result%s' % i]]
+
+def argument_default_cpp_value(argument):
+ if not argument.default_value:
+ return None
+ return argument.idl_type.literal_cpp_value(argument.default_value)
+
IdlType.union_arguments = property(lambda self: None)
IdlUnionType.union_arguments = property(union_arguments)
+IdlArgument.default_cpp_value = property(argument_default_cpp_value)
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698