/// <remarks> /// These won't be returned by GetAttributes on source methods, but they /// will be returned by GetAttributes on metadata symbols. /// </remarks> internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder <SynthesizedAttributeData> attributes) { base.AddSynthesizedAttributes(compilationState, ref attributes); CSharpCompilation compilation = this.DeclaringCompilation; if (this.ContainsExtensionMethods) { // No need to check if [Extension] attribute was explicitly set since // we'll issue CS1112 error in those cases and won't generate IL. AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor)); } if (this.Indexers.Any()) { string defaultMemberName = this.Indexers.First().MetadataName; // UNDONE: IndexerNameAttribute var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, defaultMemberName); AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute( WellKnownMember.System_Reflection_DefaultMemberAttribute__ctor, ImmutableArray.Create(defaultMemberNameConstant))); } NamedTypeSymbol baseType = this.BaseTypeNoUseSiteDiagnostics; if ((object)baseType != null) { if (baseType.ContainsDynamic()) { AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(baseType, customModifiersCount: 0)); } if (baseType.ContainsTuple()) { AddSynthesizedAttribute(ref attributes, compilation.SynthesizeTupleNamesAttributeOpt(baseType)); } } // Is this a concept or instance? // If so, add in the concept attributes, if we don't have them // already. // @t-mawind if (this.IsConcept && !this.HasConceptAttribute) { AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Concepts_ConceptAttribute__ctor)); } else if (this.IsInstance && !this.HasInstanceAttribute) { AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Concepts_ConceptInstanceAttribute__ctor)); } }