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

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

Issue 867153004: Move methods about indexed/named getters/setters/deleters to v8_utilities.py (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/v8_interface.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_utilities.py
diff --git a/Source/bindings/scripts/v8_utilities.py b/Source/bindings/scripts/v8_utilities.py
index c4935d79d17f692a3c5eba27ac07d598fc5a8d93..ba5dd6f31290cdc1522d12cf24bfdcf9739192ff 100644
--- a/Source/bindings/scripts/v8_utilities.py
+++ b/Source/bindings/scripts/v8_utilities.py
@@ -37,7 +37,7 @@ import re
from idl_types import IdlTypeBase
import idl_types
-from idl_definitions import Exposure
+from idl_definitions import Exposure, IdlInterface
from v8_globals import includes
import v8_types
@@ -397,3 +397,107 @@ def runtime_enabled_function_name(definition_or_member):
return None
feature_name = extended_attributes['RuntimeEnabled']
return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
+
+
+################################################################################
+# Indexed properties
+# http://heycam.github.io/webidl/#idl-indexed-properties
+################################################################################
+
+def indexed_property_getter(interface):
+ try:
+ # Find indexed property getter, if present; has form:
+ # getter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1)
+ return next(
+ method
+ for method in interface.operations
+ if ('getter' in method.specials and
+ len(method.arguments) == 1 and
+ str(method.arguments[0].idl_type) == 'unsigned long'))
+ except StopIteration:
+ return None
+
+
+def indexed_property_setter(interface):
+ try:
+ # Find indexed property setter, if present; has form:
+ # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1, ARG_TYPE ARG2)
+ return next(
+ method
+ for method in interface.operations
+ if ('setter' in method.specials and
+ len(method.arguments) == 2 and
+ str(method.arguments[0].idl_type) == 'unsigned long'))
+ except StopIteration:
+ return None
+
+
+def indexed_property_deleter(interface):
+ try:
+ # Find indexed property deleter, if present; has form:
+ # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG)
+ return next(
+ method
+ for method in interface.operations
+ if ('deleter' in method.specials and
+ len(method.arguments) == 1 and
+ str(method.arguments[0].idl_type) == 'unsigned long'))
+ except StopIteration:
+ return None
+
+
+################################################################################
+# Named properties
+# http://heycam.github.io/webidl/#idl-named-properties
+################################################################################
+
+def named_property_getter(interface):
+ try:
+ # Find named property getter, if present; has form:
+ # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1)
+ getter = next(
+ method
+ for method in interface.operations
+ if ('getter' in method.specials and
+ len(method.arguments) == 1 and
+ str(method.arguments[0].idl_type) == 'DOMString'))
+ getter.name = getter.name or 'anonymousNamedGetter'
+ return getter
+ except StopIteration:
+ return None
+
+
+def named_property_setter(interface):
+ try:
+ # Find named property setter, if present; has form:
+ # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2)
+ return next(
+ method
+ for method in interface.operations
+ if ('setter' in method.specials and
+ len(method.arguments) == 2 and
+ str(method.arguments[0].idl_type) == 'DOMString'))
+ except StopIteration:
+ return None
+
+
+def named_property_deleter(interface):
+ try:
+ # Find named property deleter, if present; has form:
+ # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG)
+ return next(
+ method
+ for method in interface.operations
+ if ('deleter' in method.specials and
+ len(method.arguments) == 1 and
+ str(method.arguments[0].idl_type) == 'DOMString'))
+ except StopIteration:
+ return None
+
+
+IdlInterface.indexed_property_getter = property(indexed_property_getter)
+IdlInterface.indexed_property_setter = property(indexed_property_setter)
+IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
+IdlInterface.named_property_getter = property(named_property_getter)
+IdlInterface.named_property_setter = property(named_property_setter)
+IdlInterface.named_property_deleter = property(named_property_deleter)
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698