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

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

Issue 312683005: IDL: Support optional argument default value syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased 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
Index: Source/bindings/scripts/v8_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index 7f7b83b348f2525957d2cc759bf2e2329044ffc3..d94bf1bd20288370f8f2f29babe65847abfed248 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -181,8 +181,10 @@ def generate_argument(interface, method, argument, index):
used_as_argument=True,
used_as_variadic_argument=argument.is_variadic),
'cpp_value': this_cpp_value,
+ 'default_value': str(argument.default_value) if argument.default_value else None,
Nils Barth (inactive) 2014/06/16 09:18:17 Could you add a FIXME here to check that the type
'enum_validation_expression': idl_type.enum_validation_expression,
- 'has_default': 'Default' in extended_attributes,
+ # FIXME: remove once [Default] removed and just use argument.default_value
+ 'has_default': 'Default' in extended_attributes or argument.default_value,
'has_event_listener_argument': any(
argument_so_far for argument_so_far in method.arguments[:index]
if argument_so_far.idl_type.name == 'EventListener'),
@@ -298,9 +300,10 @@ def v8_value_to_local_cpp_value(argument, index):
name = argument.name
if argument.is_variadic:
return v8_value_to_local_cpp_variadic_value(argument, index)
- # [Default=NullString]
+ # FIXME: This special way of handling string arguments with null defaults
+ # can go away once we fully support default values.
if (argument.is_optional and idl_type.name in ('String', 'ByteString') and
- extended_attributes.get('Default') == 'NullString'):
+ argument.default_value and argument.default_value.is_null):
haraken 2014/06/13 13:46:52 Just to confirm: If you write: void foo(optiona
Jens Widell 2014/06/13 14:14:52 Yes. The argumentOrNull() function returns an empt
haraken 2014/06/13 14:32:53 Sorry for not being clear. I understand that your
Jens Widell 2014/06/13 14:49:46 I see. :-) Well, if I read the spec correctly, you
haraken 2014/06/13 14:59:03 Makes sense, thanks!
Nils Barth (inactive) 2014/06/16 09:18:17 Same conclusion as Joshua (i.e., go ahead with thi
Jens Widell 2014/06/16 09:37:14 You are (both) right, naturally. And it was of cou
v8_value = 'argumentOrNull(info, %s)' % index
else:
v8_value = 'info[%s]' % index

Powered by Google App Engine
This is Rietveld 408576698