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

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

Issue 792903004: IDL: Support extended attributes on iterable<>, maplike<> and setlike<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments 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 | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idl_definitions.py
diff --git a/Source/bindings/scripts/idl_definitions.py b/Source/bindings/scripts/idl_definitions.py
index faf04fb46100aa50015b856d825fff6b9f754c95..2f3dd17e099650da2ea3a630243be865f4b62c81 100644
--- a/Source/bindings/scripts/idl_definitions.py
+++ b/Source/bindings/scripts/idl_definitions.py
@@ -48,6 +48,9 @@ IdlDefinitions
IdlOperation < TypedObject
IdlArgument < TypedObject
IdlStringifier
+ IdlIterable < IdlIterableOrMaplikeOrSetlike
+ IdlMaplike < IdlIterableOrMaplikeOrSetlike
+ IdlSetlike < IdlIterableOrMaplikeOrSetlike
IdlException < IdlInterface
(same contents as IdlInterface)
@@ -652,49 +655,61 @@ class IdlStringifier(object):
# Iterable, Maplike, Setlike
################################################################################
-class IdlIterable(object):
+class IdlIterableOrMaplikeOrSetlike(object):
def __init__(self, idl_name, node):
- children = node.GetChildren()
+ self.extended_attributes = {}
+ self.type_children = []
+
+ for child in node.GetChildren():
+ child_class = child.GetClass()
+ if child_class == 'ExtAttributes':
+ self.extended_attributes = ext_attributes_node_to_extended_attributes(idl_name, child)
+ elif child_class == 'Type':
+ self.type_children.append(child)
+ else:
+ raise ValueError('Unrecognized node class: %s' % child_class)
- # FIXME: Support extended attributes.
- if len(children) == 1:
+class IdlIterable(IdlIterableOrMaplikeOrSetlike):
+ def __init__(self, idl_name, node):
+ super(IdlIterable, self).__init__(idl_name, node)
+
+ if len(self.type_children) == 1:
self.key_type = None
- self.value_type = type_node_to_type(children[0])
- elif len(children) == 2:
- self.key_type = type_node_to_type(children[0])
- self.value_type = type_node_to_type(children[1])
+ self.value_type = type_node_to_type(self.type_children[0])
+ elif len(self.type_children) == 2:
+ self.key_type = type_node_to_type(self.type_children[0])
+ self.value_type = type_node_to_type(self.type_children[1])
else:
- raise ValueError('Unexpected number of children: %d' % len(children))
+ raise ValueError('Unexpected number of type children: %d' % len(self.type_children))
+ del self.type_children
-class IdlMaplike(object):
+class IdlMaplike(IdlIterableOrMaplikeOrSetlike):
def __init__(self, idl_name, node):
- self.is_read_only = bool(node.GetProperty('READONLY'))
+ super(IdlMaplike, self).__init__(idl_name, node)
- children = node.GetChildren()
-
- # FIXME: Support extended attributes.
+ self.is_read_only = bool(node.GetProperty('READONLY'))
- if len(children) == 2:
- self.key_type = type_node_to_type(children[0])
- self.value_type = type_node_to_type(children[1])
+ if len(self.type_children) == 2:
+ self.key_type = type_node_to_type(self.type_children[0])
+ self.value_type = type_node_to_type(self.type_children[1])
else:
- raise ValueError('Unexpected number of children: %d' % len(children))
+ raise ValueError('Unexpected number of children: %d' % len(self.type_children))
+ del self.type_children
-class IdlSetlike(object):
+class IdlSetlike(IdlIterableOrMaplikeOrSetlike):
def __init__(self, idl_name, node):
- self.is_read_only = bool(node.GetProperty('READONLY'))
-
- children = node.GetChildren()
+ super(IdlSetlike, self).__init__(idl_name, node)
- # FIXME: Support extended attributes.
+ self.is_read_only = bool(node.GetProperty('READONLY'))
- if len(children) == 1:
- self.value_type = type_node_to_type(children[0])
+ if len(self.type_children) == 1:
+ self.value_type = type_node_to_type(self.type_children[0])
else:
- raise ValueError('Unexpected number of children: %d' % len(children))
+ raise ValueError('Unexpected number of children: %d' % len(self.type_children))
+ del self.type_children
################################################################################
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698