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

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

Issue 229373006: Support optional, non-defaulted constructor arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Formatting Created 6 years, 8 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 | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index e3d8f4c3a621a2d9fbab144f78d90d6222d5a899..af6e0b656df6eb34b6a583d25e6864dc4f29c861 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -453,7 +453,7 @@ def overload_check_argument(index, argument):
def generate_constructor(interface, constructor):
return {
'argument_list': constructor_argument_list(interface, constructor),
- 'arguments': [constructor_argument(argument, index)
+ 'arguments': [constructor_argument(interface, constructor, argument, index)
for index, argument in enumerate(constructor.arguments)],
'has_exception_state':
# [RaisesException=Constructor]
@@ -462,6 +462,7 @@ def generate_constructor(interface, constructor):
if argument.idl_type.name == 'SerializedScriptValue' or
argument.idl_type.is_integer_type),
'is_constructor': True,
+ 'is_named_constructor': False,
'is_variadic': False, # Required for overload resolution
'number_of_required_arguments':
number_of_required_arguments(constructor),
@@ -486,13 +487,15 @@ def constructor_argument_list(interface, constructor):
return arguments
-def constructor_argument(argument, index):
+def constructor_argument(interface, constructor, argument, index):
idl_type = argument.idl_type
return {
+ 'cpp_value':
+ v8_methods.cpp_value(interface, constructor, index),
'has_default': 'Default' in argument.extended_attributes,
- 'idl_type_object': idl_type,
# Dictionary is special-cased, but arrays and sequences shouldn't be
'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
+ 'idl_type_object': idl_type,
'index': index,
'is_optional': argument.is_optional,
'is_strict_type_checking': False, # Required for overload resolution
@@ -524,7 +527,10 @@ def generate_named_constructor(interface):
idl_constructor = interface.constructors[0]
constructor = generate_constructor(interface, idl_constructor)
constructor['argument_list'].insert(0, '*document')
- constructor['name'] = extended_attributes['NamedConstructor']
+ constructor.update({
+ 'name': extended_attributes['NamedConstructor'],
+ 'is_named_constructor': True,
+ })
return constructor
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698