public void EmbedAllMembersOfImplementedInterface(SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics) { Debug.Assert(UnderlyingNamedType.IsInterfaceType()); if (_embeddedAllMembersOfImplementedInterface) { return; } _embeddedAllMembersOfImplementedInterface = true; // Embed all members foreach (MethodSymbol m in UnderlyingNamedType.GetMethodsToEmit()) { if ((object)m != null) { TypeManager.EmbedMethod(this, m, syntaxNodeOpt, diagnostics); } } // We also should embed properties and events, but we don't need to do this explicitly here // because accessors embed them automatically. // Do the same for implemented interfaces. foreach (NamedTypeSymbol @interface in UnderlyingNamedType.GetInterfacesToEmit()) { TypeManager.ModuleBeingBuilt.Translate(@interface, syntaxNodeOpt, diagnostics, fromImplements: true); } }
protected override IEnumerable <Cci.ITypeReference> GetInterfaces(Microsoft.CodeAnalysis.Emit.Context context) { Debug.Assert((object)TypeManager.ModuleBeingBuilt == context.Module); PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; foreach (NamedTypeSymbol @interface in UnderlyingNamedType.GetInterfacesToEmit()) { yield return(moduleBeingBuilt.Translate(@interface, (CSharpSyntaxNode)context.SyntaxNodeOpt, context.Diagnostics)); } }
protected override IEnumerable <Cci.TypeReferenceWithAttributes> GetInterfaces(EmitContext context) { Debug.Assert((object)TypeManager.ModuleBeingBuilt == context.Module); PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; foreach (NamedTypeSymbol @interface in UnderlyingNamedType.GetInterfacesToEmit()) { var typeRef = moduleBeingBuilt.Translate( @interface, (CSharpSyntaxNode)context.SyntaxNodeOpt, context.Diagnostics); yield return(@interface.GetTypeRefWithAttributes( UnderlyingNamedType.DeclaringCompilation, typeRef)); } }