-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create AutoPropertyBackingFieldSymbol.cs
- Loading branch information
1 parent
bfdedda
commit 74447f3
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...raco.Compiler/Internal/Symbols/Synthetized/AutoProperty/AutoPropertyBackingFieldSymbol.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |