def AddMembers(self, interface, declare_only=False): for const in sorted(interface.constants, ConstantOutputOrder): self.AddConstant(const) for attr in sorted(interface.attributes, ConstantOutputOrder): if attr.type.id != 'EventListener': self.AddAttribute(attr, declare_only) # The implementation should define an indexer if the interface directly # extends List. element_type = None requires_indexer = False if self._interface_type_info.list_item_type(): self.AddIndexer(self._interface_type_info.list_item_type()) else: for parent in self._database.Hierarchy(self._interface): if parent == self._interface: continue parent_type_info = self._type_registry.TypeInfo(parent.id) if parent_type_info.list_item_type(): self.AmendIndexer(parent_type_info.list_item_type()) break # Group overloaded operations by name. operationsByName = self._OperationsByName(interface) # Generate operations. 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 convert_to_future_members): self.AddOperation(ConvertToFuture(info), declare_only)
def AddMembers(self, interface, declare_only=False, dart_js_interop=False): if self._interface.id == 'WebGLRenderingContextBase' or self._interface.id == 'WebGL2RenderingContextBase' or \ self._interface.id == 'WebGLDrawBuffers': # Constants in classes WebGLRenderingContextBase, WebGL2RenderingContext, WebGLDrawBuffers are consolidated into # one synthesized class (WebGL). self._gl_constants.extend(interface.constants) else: for const in sorted(interface.constants, ConstantOutputOrder): self.AddConstant(const) for attr in sorted(interface.attributes, ConstantOutputOrder): if attr.type.id != 'EventHandler' and attr.type.id != 'EventListener': self.AddAttribute(attr, declare_only) # The implementation should define an indexer if the interface directly # extends List. element_type = None requires_indexer = False if self._interface_type_info.list_item_type(): self.AddIndexer( self._interface_type_info.list_item_type(), self._interface_type_info.list_item_type_nullable()) else: for parent in self._database.Hierarchy(self._interface): if parent == self._interface: continue parent_type_info = self._type_registry.TypeInfo(parent.id) if parent_type_info.list_item_type(): self.AmendIndexer(parent_type_info.list_item_type()) break # Group overloaded operations by name. self._AddRenamedOverloads(interface) operationsByName = self._OperationsByName(interface) if self.OmitOperationOverrides(): self._RemoveShadowingOperationsWithSameSignature( operationsByName, interface) # Generate operations. for id in sorted(operationsByName.keys()): operations = operationsByName[id] info = AnalyzeOperation(interface, operations) info.nnbd = self._nnbd self.AddOperation(info, declare_only, dart_js_interop) if ('%s.%s' % (interface.id, info.declared_name) in convert_to_future_members): self.AddOperation(ConvertToFuture(info), declare_only)