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

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

Issue 911433003: IDL: Auto-declare remaining methods implied by maplike<>/setlike<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-iterable-continued
Patch Set: Created 5 years, 10 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_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index 8b80f3b120428d406e0f0efff62302e9c98c0a72..fbf05746a9e10400d5332731a907db557d00f78e 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -398,6 +398,52 @@ def interface_context(interface):
extended_attributes=forEach_extended_attributes),
]
+ if interface.maplike:
+ key_argument = generated_argument(interface.maplike.key_type, 'key')
+ value_argument = generated_argument(interface.maplike.value_type, 'value')
+
+ implicit_methods.extend([
+ generated_method(IdlType('boolean'), 'has',
+ arguments=[key_argument],
+ extended_attributes=used_extended_attributes),
+ generated_method(IdlType('any'), 'get',
+ arguments=[key_argument],
+ extended_attributes=used_extended_attributes),
+ ])
+
+ if not interface.maplike.is_read_only:
+ implicit_methods.extend([
+ generated_method(IdlType('void'), 'clear',
+ extended_attributes=used_extended_attributes),
+ generated_method(IdlType('boolean'), 'delete',
+ arguments=[key_argument],
+ extended_attributes=used_extended_attributes),
+ generated_method(IdlType(interface.name), 'set',
+ arguments=[key_argument, value_argument],
+ extended_attributes=used_extended_attributes),
+ ])
+
+ if interface.setlike:
+ value_argument = generated_argument(interface.setlike.value_type, 'value')
+
+ implicit_methods.extend([
+ generated_method(IdlType('boolean'), 'has',
+ arguments=[value_argument],
+ extended_attributes=used_extended_attributes),
+ ])
+
+ if not interface.setlike.is_read_only:
+ implicit_methods.extend([
+ generated_method(IdlType(interface.name), 'add',
+ arguments=[value_argument],
+ extended_attributes=used_extended_attributes),
+ generated_method(IdlType('void'), 'clear',
+ extended_attributes=used_extended_attributes),
+ generated_method(IdlType('boolean'), 'delete',
+ arguments=[value_argument],
+ extended_attributes=used_extended_attributes),
+ ])
+
methods_by_name = {}
for method in methods:
methods_by_name.setdefault(method['name'], []).append(method)
@@ -409,8 +455,7 @@ def interface_context(interface):
methods.append(implicit_method)
# FIXME: maplike<> and setlike<> should also imply the presence of a
- # subset of keys(), values(), entries(), forEach(), has(), get(), add(),
- # set(), delete() and clear(), and a 'size' attribute.
+ # 'size' attribute.
# Stringifier
if interface.stringifier:

Powered by Google App Engine
This is Rietveld 408576698