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

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

Issue 807263007: IDL: Add forEach() method to iterable<>/maplike<>/setlike<> interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: adjust test expectations Created 5 years, 11 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') | Source/bindings/scripts/v8_utilities.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 17691b0678c5f4b4c156f331ce83b395c5ccf2a0..623308484300aed627cf267fdfd48297db28a051 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,15 @@ 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, extended_attributes=None):
+ argument = IdlArgument(interface.idl_name)
+ argument.idl_type = idl_type
+ argument.name = name
+ argument.is_optional = is_optional
+ 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 +370,11 @@ def interface_context(interface):
'CallWith': 'ScriptState',
})
+ forEach_extended_attributes = used_extended_attributes.copy()
+ forEach_extended_attributes.update({
+ 'CallWith': ['ScriptState', 'ThisValue'],
+ })
+
def generated_iterator_method(name):
return generated_method(
return_type=IdlType('Iterator'),
@@ -374,6 +388,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
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698