def TransitiveSecondaryParents(self, interface, propagate_event_target): """Returns a list of all non-primary parents. The list contains the interface objects for interfaces defined in the database, and the name for undefined interfaces. """ def walk(parents, walk_result): for parent in parents: parent_name = parent.type.id if IsDartCollectionType(parent_name): if not (parent_name in walk_result): walk_result.append(parent_name) continue if self.HasInterface(parent_name): parent_interface = self.GetInterface(parent_name) if not (parent_interface in walk_result): # Interface has multi-inherited don't add interfaces more than once # to our parent result list. walk_result.append(parent_interface) walk(parent_interface.parents, walk_result) return walk_result result = [] if interface.parents: parent = interface.parents[0] if (IsPureInterface(parent.type.id, self) or (propagate_event_target and parent.type.id == 'EventTarget')): result = walk(interface.parents, []) else: result = walk(interface.parents[1:], []) return result
def TransitiveSecondaryParents(self, interface, propagate_event_target): """Returns a list of all non-primary parents. The list contains the interface objects for interfaces defined in the database, and the name for undefined interfaces. """ def walk(parents): for parent in parents: parent_name = parent.type.id if IsDartCollectionType(parent_name): result.append(parent_name) continue if self.HasInterface(parent_name): parent_interface = self.GetInterface(parent_name) result.append(parent_interface) walk(parent_interface.parents) result = [] if interface.parents: parent = interface.parents[0] if (IsPureInterface(parent.type.id) or (propagate_event_target and parent.type.id == 'EventTarget')): walk(interface.parents) else: walk(interface.parents[1:]) return result
def _TransitiveSecondaryParents(self, interface): """Returns a list of all non-primary parents. The list contains the interface objects for interfaces defined in the database, and the name for undefined interfaces. """ def walk(parents): for parent in parents: parent_name = parent.type.id if parent_name == 'EventTarget': # Currently EventTarget is implemented as a mixin, not a proper # super interface---ignore its members. continue if IsDartCollectionType(parent_name): result.append(parent_name) continue if self._database.HasInterface(parent_name): parent_interface = self._database.GetInterface(parent_name) result.append(parent_interface) walk(parent_interface.parents) result = [] if interface.parents: parent = interface.parents[0] if IsPureInterface(parent.type.id): walk(interface.parents) else: walk(interface.parents[1:]) return result
def _RemoveShadowingOperationsWithSameSignature(self, operationsByName, interface): if not interface.parents: return parent_name = interface.parents[0].type.id parent = self._database.GetInterface(parent_name) if parent == self._interface or parent == interface: return # Never remove operations that are added as a result of an implements they # are pure interfaces (mixins to this interface). if (IsPureInterface(parent_name, self._database)): return for operation in parent.operations: if operation.id in operationsByName: operations = operationsByName[operation.id] for existing_operation in operations: if existing_operation.SameSignatureAs(operation): del operationsByName[operation.id]