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

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
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | no next file » | 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 4cb00489c1f47da8882505ab320504f675e3ce1c..533e903f68821aa1f593e9313bdac1fed3fd2ea3 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -168,6 +168,7 @@ def generate_argument(interface, method, argument, index):
'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type),
'is_wrapper_type': idl_type.is_wrapper_type,
'name': argument.name,
+ 'default_value': argument.default_value,
Nils Barth (inactive) 2014/05/16 12:22:54 Alphabetical order please.
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index),
@@ -195,7 +196,8 @@ def cpp_value(interface, method, number_of_arguments):
return argument.name
# Truncate omitted optional arguments
Nils Barth (inactive) 2014/05/16 12:22:54 Could you move these down to the cpp_arguments.ext
- arguments = method.arguments[:number_of_arguments]
+ required_arguments = method.arguments[:number_of_arguments]
+ optional_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 +205,8 @@ 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 required_arguments)
Nils Barth (inactive) 2014/05/16 12:22:54 Line breaks please, here and next line: loop and c
+ cpp_arguments.extend(argument.default_value for argument in optional_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)
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698