def AddSecondaryMembers(self, interface): # With multiple inheritance, attributes and operations of non-first # interfaces need to be added. Sometimes the attribute or operation is # defined in the current interface as well as a parent. In that case we # avoid making a duplicate definition and pray that the signatures match. secondary_parents = self._TransitiveSecondaryParents(interface) for parent_interface in sorted(secondary_parents): if isinstance(parent_interface, str): continue for attr in sorted(parent_interface.attributes, ConstantOutputOrder): if not FindMatchingAttribute(interface, attr): self.SecondaryContext(parent_interface) self.AddAttribute(attr) # Group overloaded operations by name. operationsByName = self._OperationsByName(parent_interface) # Generate operations. for id in sorted(operationsByName.keys()): if not any(op.id == id for op in interface.operations): operations = operationsByName[id] info = AnalyzeOperation(interface, operations) self.SecondaryContext(parent_interface) self.AddOperation(info)
def AddSecondaryMembers(self, interface): secondary_parents = self._database.TransitiveSecondaryParents(interface, not self._dart_use_blink) remove_duplicate_parents = list(set(secondary_parents)) if len(secondary_parents) != len(remove_duplicate_parents): secondary_parents = remove_duplicate_parents parent_list = ", ".join([" %s" % (parent.id) for parent in secondary_parents]) _logger.warn('Interface %s has duplicate parent interfaces %s - ' \ 'ignoring duplicates. Please file a bug with the dart:html team.' % (interface.id, parent_list)) for parent_interface in sorted(secondary_parents): if isinstance(parent_interface, str): continue for attr in sorted(parent_interface.attributes, ConstantOutputOrder): if not FindMatchingAttribute(interface, attr): if attr.type.id != 'EventHandler': self.SecondaryContext(parent_interface) self.AddAttribute(attr) # Group overloaded operations by name. operationsByName =self._OperationsByName(parent_interface) if self.OmitOperationOverrides(): self._RemoveShadowingOperationsWithSameSignature(operationsByName, interface) # Generate operations. for id in sorted(operationsByName.keys()): if not any(op.id == id for op in interface.operations): operations = operationsByName[id] info = AnalyzeOperation(interface, operations) self.SecondaryContext(parent_interface) self.AddOperation(info)
def AddSecondaryMembers(self, interface): # With multiple inheritance, attributes and operations of non-first # interfaces need to be added. Sometimes the attribute or operation is # defined in the current interface as well as a parent. In that case we # avoid making a duplicate definition and pray that the signatures match. if not self._renamer.ShouldSuppressInterface(interface): secondary_constants = sorted(self._HoistableConstants(interface), ConstantOutputOrder) for const in secondary_constants: self.AddConstant(const) secondary_parents = self._database.TransitiveSecondaryParents( interface, not self._dart_use_blink) remove_duplicate_parents = list(set(secondary_parents)) if len(secondary_parents) != len(remove_duplicate_parents): secondary_parents = remove_duplicate_parents parent_list = ", ".join( [" %s" % (parent.id) for parent in secondary_parents]) _logger.warn('Interface %s has duplicate parent interfaces %s - ' \ 'ignoring duplicates. Please file a bug with the dart:html team.' % (interface.id, parent_list)) for parent_interface in sorted(secondary_parents): if isinstance(parent_interface, str): continue for attr in sorted(parent_interface.attributes, ConstantOutputOrder): if not FindMatchingAttribute(interface, attr): if attr.type.id != 'EventHandler': self.SecondaryContext(parent_interface) self.AddAttribute(attr) # Group overloaded operations by name. operationsByName = self._OperationsByName(parent_interface) if self.OmitOperationOverrides(): self._RemoveShadowingOperationsWithSameSignature( operationsByName, interface) # Generate operations. for id in sorted(operationsByName.keys()): if not any(op.id == id for op in interface.operations): operations = operationsByName[id] info = AnalyzeOperation(interface, operations) self.SecondaryContext(parent_interface) self.AddOperation(info)