Chromium Code Reviews| Index: tools/dom/scripts/htmldartgenerator.py |
| diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py |
| index 30ccdd03614008e848de99e8d068467101e381d9..d0dd0f6097a7fda09a1492a3f5517f86d763fc50 100644 |
| --- a/tools/dom/scripts/htmldartgenerator.py |
| +++ b/tools/dom/scripts/htmldartgenerator.py |
| @@ -82,16 +82,12 @@ class HtmlDartGenerator(object): |
| self.AmendIndexer(parent_type_info.list_item_type()) |
| break |
| - # Group overloaded operations by id. |
| - operationsById = {} |
| - for operation in interface.operations: |
| - if operation.id not in operationsById: |
| - operationsById[operation.id] = [] |
| - operationsById[operation.id].append(operation) |
| + # Group overloaded operations by name. |
| + operationsByName = self._OperationsByName(interface) |
| # Generate operations. |
| - for id in sorted(operationsById.keys()): |
| - operations = operationsById[id] |
| + for id in sorted(operationsByName.keys()): |
| + operations = operationsByName[id] |
| info = AnalyzeOperation(interface, operations) |
| self.AddOperation(info, declare_only) |
| if ('%s.%s' % (interface.id, info.declared_name) in |
| @@ -112,21 +108,26 @@ class HtmlDartGenerator(object): |
| self.SecondaryContext(parent_interface) |
| self.AddAttribute(attr) |
| - # Group overloaded operations by id. |
| - operationsById = {} |
| - for operation in parent_interface.operations: |
| - if operation.id not in operationsById: |
| - operationsById[operation.id] = [] |
| - operationsById[operation.id].append(operation) |
| + # Group overloaded operations by name. |
| + operationsByName =self. _OperationsByName(parent_interface) |
|
Anton Muhin
2013/03/21 14:03:02
nit: unnecessary space after .
blois
2013/03/21 16:55:43
Done.
|
| # Generate operations. |
| - for id in sorted(operationsById.keys()): |
| + for id in sorted(operationsByName.keys()): |
| if not any(op.id == id for op in interface.operations): |
| - operations = operationsById[id] |
| + operations = operationsByName[id] |
| info = AnalyzeOperation(interface, operations) |
| self.SecondaryContext(parent_interface) |
| self.AddOperation(info) |
| + def _OperationsByName(self, interface): |
| + operationsByName = {} |
| + for operation in interface.operations: |
| + name = operation.ext_attrs.get('DartName', operation.id) |
| + if name not in operationsByName: |
|
Anton Muhin
2013/03/21 14:03:02
those three lines can be rewritten as:
operations
blois
2013/03/21 16:55:43
Think it has to be:
operationsByName.setdefault(na
Anton Muhin
2013/03/21 16:56:51
My bad and you're right, sorry.
On 2013/03/21 16:
|
| + operationsByName[name] = [] |
| + operationsByName[name].append(operation) |
| + return operationsByName |
| + |
| def AddConstant(self, constant): |
| const_name = self._renamer.RenameMember( |
| self._interface.id, constant, constant.id, 'get:', dartify_name=False) |