Skip to content

Commit

Permalink
Create AutoPropertyBackingFieldSymbol.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Oct 25, 2024
1 parent bfdedda commit 74447f3
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Draco.Compiler.Internal.Symbols.Synthetized.AutoProperty;

/// <summary>
/// Auto-generated backing field for an auto-property.
/// </summary>
internal sealed class AutoPropertyBackingFieldSymbol(
TypeSymbol containingSymbol,
PropertySymbol property) : FieldSymbol
{
public override TypeSymbol ContainingSymbol { get; } = containingSymbol;

public override TypeSymbol Type => this.Property.Type;
public override bool IsStatic => this.Property.IsStatic;
public override bool IsMutable => this.Property.Setter is not null;
public override string Name => $"<{this.Property.Name}>_BackingField";
public override Api.Semantics.Visibility Visibility => Api.Semantics.Visibility.Private;

/// <summary>
/// The property this backing field is for.
/// </summary>
public PropertySymbol Property { get; } = property;
}

0 comments on commit 74447f3

Please sign in to comment.