Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/scripts/idl_definitions.py |
| diff --git a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py |
| index 6f67f8ebe0d0bd42eda01ea9b0af6f5f395e8491..c1ad46c3baec11fa37ac6d3177e3820c6decf257 100644 |
| --- a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py |
| +++ b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py |
| @@ -286,6 +286,7 @@ class IdlInterface(object): |
| self.serializer = None |
| self.stringifier = None |
| self.iterable = None |
| + self.has_indexed_elements = False |
| self.maplike = None |
| self.setlike = None |
| self.original_interface = None |
| @@ -301,11 +302,17 @@ class IdlInterface(object): |
| self.name = node.GetName() |
| self.idl_type = IdlType(self.name) |
| + has_indexed_property_getter = False |
| + has_integer_typed_length = False |
| + |
| children = node.GetChildren() |
| for child in children: |
| child_class = child.GetClass() |
| if child_class == 'Attribute': |
| - self.attributes.append(IdlAttribute(idl_name, child)) |
| + attr = IdlAttribute(idl_name, child) |
| + if attr.idl_type.is_integer_type: |
|
Jens Widell
2015/10/05 05:57:11
Shouldn't we also check that the name is 'length'
caitp (gmail)
2015/10/05 11:30:23
Yes, good catch. Done
|
| + has_integer_typed_length = True |
| + self.attributes.append(attr) |
| elif child_class == 'Const': |
| self.constants.append(IdlConstant(idl_name, child)) |
| elif child_class == 'ExtAttributes': |
| @@ -315,7 +322,10 @@ class IdlInterface(object): |
| clear_constructor_attributes(extended_attributes) |
| self.extended_attributes = extended_attributes |
| elif child_class == 'Operation': |
| - self.operations.append(IdlOperation(idl_name, child)) |
| + op = IdlOperation(idl_name, child) |
| + if 'getter' in op.specials and len(op.arguments) == 1 and op.arguments[0].idl_type == 'unsigned long': |
|
Jens Widell
2015/10/05 05:57:11
Checking len(op.arguments) is a bit optional here;
caitp (gmail)
2015/10/05 11:30:23
Done
|
| + has_indexed_property_getter = True |
| + self.operations.append(op) |
| elif child_class == 'Inherit': |
| self.parent = child.GetName() |
| elif child_class == 'Serializer': |
| @@ -336,6 +346,9 @@ class IdlInterface(object): |
| if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1: |
| raise ValueError('Interface can only have one of iterable<>, maplike<> and setlike<>.') |
| + if has_integer_typed_length and has_indexed_property_getter: |
| + self.has_indexed_elements = True |
| + |
| def accept(self, visitor): |
| visitor.visit_interface(self) |
| for attribute in self.attributes: |