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

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

Issue 272213005: Support WebIDL optional default value syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index 4cb00489c1f47da8882505ab320504f675e3ce1c..b4b0fca034075e95fcb02fb5d8de829d72e51e7f 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -145,6 +145,7 @@ def generate_argument(interface, method, argument, index):
return {
'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrapper_type),
'cpp_value': this_cpp_value,
+ 'default_value': argument.default_value,
'enum_validation_expression': idl_type.enum_validation_expression,
'has_default': 'Default' in extended_attributes,
'has_event_listener_argument': any(
@@ -194,8 +195,6 @@ def cpp_value(interface, method, number_of_arguments):
return '%s.release()' % argument.name
return argument.name
- # Truncate omitted optional arguments
- arguments = method.arguments[:number_of_arguments]
cpp_arguments = v8_utilities.call_with_arguments(method)
# Members of IDL partial interface definitions are implemented in C++ as
# static member functions, which for instance members (non-static members)
@@ -203,7 +202,11 @@ def cpp_value(interface, method, number_of_arguments):
if ('PartialInterfaceImplementedAs' in method.extended_attributes and
not method.is_static):
cpp_arguments.append('*impl')
- cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
+ cpp_arguments.extend(cpp_argument(argument)
+ for argument in method.arguments[:number_of_arguments])
+ cpp_arguments.extend(argument.default_value
+ for argument in method.arguments[number_of_arguments:]
+ if argument.is_optional and argument.default_value)
this_union_arguments = method.idl_type and method.idl_type.union_arguments
if this_union_arguments:
cpp_arguments.extend(this_union_arguments)
« Source/bindings/scripts/idl_definitions.py ('K') | « Source/bindings/scripts/idl_definitions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698