| File: Symbols\Synthesized\SynthesizedFieldSymbol.cs | Web Access |
| Project: src\roslyn\src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj (Microsoft.CodeAnalysis.CSharp) |
// 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.Immutable; using System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { /// <summary> /// Represents a compiler generated field. /// </summary> /// <summary> /// Represents a compiler generated field of given type and name. /// </summary> internal sealed class SynthesizedFieldSymbol : SynthesizedFieldSymbolBase { private readonly TypeWithAnnotations _type; public SynthesizedFieldSymbol( NamedTypeSymbol containingType, TypeSymbol type, string name, DeclarationModifiers accessibility = DeclarationModifiers.Private, bool isReadOnly = false, bool isStatic = false) : base(containingType, name, accessibility, isReadOnly, isStatic) { Debug.Assert((object)type != null); _type = TypeWithAnnotations.Create(type); } public override RefKind RefKind => RefKind.None; public override ImmutableArray<CustomModifier> RefCustomModifiers => ImmutableArray<CustomModifier>.Empty; internal override bool SuppressDynamicAttribute { get { return true; } } internal sealed override CallerUnsafeMode GetCallerUnsafeMode(ConsList<FieldSymbol> fieldsBeingBound) => CallerUnsafeMode.None; internal override TypeWithAnnotations GetFieldType(ConsList<FieldSymbol> fieldsBeingBound) { return _type; } } }