/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Emitter/Model/SourceAssemblySymbolAdapter.cs
36 строк
2 KB
AlekseyTs
Propagate marked attributes from primary constructor parameters to backing fields. (#76475)
20 дек 2024, 07:11
Не верифицирован
20 дек 2024, 07:11
cf5eed2
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.CSharp.Emit; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal partial class SourceAssemblySymbol { internal IEnumerable<CSharpAttributeData> GetCustomAttributesToEmit(PEModuleBuilder moduleBuilder, bool emittingRefAssembly, bool emittingAssemblyAttributesInNetModule) { CheckDefinitionInvariant(); ImmutableArray<CSharpAttributeData> userDefined = this.GetAttributes(); ArrayBuilder<CSharpAttributeData> synthesized = null; this.AddSynthesizedAttributes(moduleBuilder, ref synthesized); if (emittingRefAssembly && !HasReferenceAssemblyAttribute) { var referenceAssemblyAttribute = this.DeclaringCompilation .TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_ReferenceAssemblyAttribute__ctor, isOptionalUse: true); Symbol.AddSynthesizedAttribute(ref synthesized, referenceAssemblyAttribute); } // Note that callers of this method (CCI and ReflectionEmitter) have to enumerate // all items of the returned iterator, otherwise the synthesized ArrayBuilder may leak. return GetCustomAttributesToEmit(userDefined, synthesized, isReturnType: false, emittingAssemblyAttributesInNetModule: emittingAssemblyAttributesInNetModule); } } }