Chromium Code Reviews| Index: tools/dom/scripts/htmldartgenerator.py |
| diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py |
| index 52d1de8e3ab088443839ffe0af5c66cfcc22efc5..c49e9f8b694941b4885cac73e74db4e3813e9f9d 100644 |
| --- a/tools/dom/scripts/htmldartgenerator.py |
| +++ b/tools/dom/scripts/htmldartgenerator.py |
| @@ -93,6 +93,8 @@ class HtmlDartGenerator(object): |
| # Group overloaded operations by name. |
| self._AddRenamedOverloads(interface) |
| operationsByName = self._OperationsByName(interface) |
| + if self.OmitOperationOverrides(): |
| + self._FilterOverloads(operationsByName, interface) |
| # Generate operations. |
| for id in sorted(operationsByName.keys()): |
| @@ -121,6 +123,9 @@ class HtmlDartGenerator(object): |
| # Group overloaded operations by name. |
| operationsByName =self._OperationsByName(parent_interface) |
| + if self.OmitOperationOverrides(): |
| + self._FilterOverloads(operationsByName, interface) |
| + |
| # Generate operations. |
| for id in sorted(operationsByName.keys()): |
| if not any(op.id == id for op in interface.operations): |
| @@ -129,6 +134,20 @@ class HtmlDartGenerator(object): |
| self.SecondaryContext(parent_interface) |
| self.AddOperation(info) |
| + def _FilterOverloads(self, operationsByName, interface): |
|
sra1
2013/08/12 21:31:29
'_RemoveShadowingOperationsWithSameSignature'
blois
2013/08/13 00:22:15
Done.
|
| + if not interface.parents: |
| + return |
| + |
| + parent = self._database.GetInterface(interface.parents[0].type.id) |
| + if parent == self._interface or parent == interface: |
| + return |
| + for operation in parent.operations: |
| + if operation.id in operationsByName: |
| + operations = operationsByName[operation.id] |
| + for existing_operation in operations: |
| + if existing_operation.ComparableTo(operation): |
| + del operationsByName[operation.id] |
| + |
| def _AddRenamedOverloads(self, interface): |
| """The IDL has a number of functions with the same name but that accept |
| different types. This is fine for JavaScript, but results in vague type |
| @@ -201,6 +220,9 @@ class HtmlDartGenerator(object): |
| operationsByName.setdefault(name, []).append(operation) |
| return operationsByName |
| + def OmitOperationOverrides(self): |
| + return False |
| + |
| def AddConstant(self, constant): |
| const_name = self._renamer.RenameMember( |
| self._interface.id, constant, constant.id, 'get:', dartify_name=False) |