Chromium Code Reviews| Index: Source/bindings/scripts/v8_interface.py |
| diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py |
| index bcabae0c603b847ad2388216ded702052f809359..e87a4d2b2c965c3016771fe610395a4c07c4abc4 100644 |
| --- a/Source/bindings/scripts/v8_interface.py |
| +++ b/Source/bindings/scripts/v8_interface.py |
| @@ -37,7 +37,7 @@ import itertools |
| from operator import itemgetter |
| import idl_definitions |
| -from idl_definitions import IdlOperation |
| +from idl_definitions import IdlOperation, IdlArgument |
| import idl_types |
| from idl_types import IdlType, inherits_interface |
| import v8_attributes |
| @@ -332,6 +332,16 @@ def interface_context(interface): |
| operation.extended_attributes.update(extended_attributes) |
| return v8_methods.method_context(interface, operation) |
| + def generated_argument(idl_type, name, is_optional=False, default_value=None, extended_attributes=None): |
|
haraken
2015/01/27 01:56:30
It looks like default_value is unused.
Jens Widell
2015/01/27 07:19:23
Yes, not needed at the moment. Not on the radar th
|
| + argument = IdlArgument(interface.idl_name) |
| + argument.idl_type = idl_type |
| + argument.name = name |
| + argument.is_optional = is_optional |
| + argument.default_value = default_value |
| + if extended_attributes: |
| + argument.extended_attributes.update(extended_attributes) |
| + return argument |
| + |
| # [Iterable], iterable<>, maplike<> and setlike<> |
| iterator_method = None |
| # FIXME: support Iterable in partial interfaces. However, we don't |
| @@ -361,6 +371,11 @@ def interface_context(interface): |
| 'CallWith': 'ScriptState', |
| }) |
| + forEach_extended_attributes = used_extended_attributes.copy() |
|
haraken
2015/01/27 01:56:30
Can't we just use used_extended_attributes? In oth
Jens Widell
2015/01/27 07:19:23
I am essentially using used_extended_attributes. I
|
| + forEach_extended_attributes.update({ |
| + 'CallWith': ['ScriptState', 'ThisValue'], |
| + }) |
| + |
| def generated_iterator_method(name): |
| return generated_method( |
| return_type=IdlType('Iterator'), |
| @@ -374,6 +389,14 @@ def interface_context(interface): |
| generated_iterator_method('keys'), |
| generated_iterator_method('values'), |
| generated_iterator_method('entries'), |
| + |
| + # void forEach(Function callback, [Default=Undefined] optional any thisArg) |
| + generated_method(IdlType('void'), 'forEach', |
| + arguments=[generated_argument(IdlType('Function'), 'callback'), |
| + generated_argument(IdlType('any'), 'thisArg', |
| + is_optional=True, |
| + extended_attributes={'Default': 'Undefined'})], |
| + extended_attributes=forEach_extended_attributes), |
| ]) |
| # FIXME: maplike<> and setlike<> should also imply the presence of a |