Skip to content

Commit 01beb2a

Browse files
committed
#191 - replace backing fields with field keyword for automatic properties
1 parent 9b1d4c8 commit 01beb2a

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/Domain/HydraScript.Domain.BackEnd/Impl/Addresses/HashAddress.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace HydraScript.Domain.BackEnd.Impl.Addresses;
55
public class HashAddress(int seed) : IAddress
66
{
77
private readonly int _seed = seed;
8-
private string? _name;
98

109
private readonly Guid _id = Guid.NewGuid();
1110

@@ -15,14 +14,14 @@ public string Name
1514
{
1615
get
1716
{
18-
if (_name is null)
17+
if (field is null)
1918
{
2019
var baseName = $"{unchecked((uint)GetHashCode())}{_id:N}";
2120
var nameArray = Random.Shared.GetItems(baseName.AsSpan(), 10);
22-
_name = ZString.Concat("_t", new string(nameArray));
21+
field = ZString.Concat("_t", new string(nameArray));
2322
}
2423

25-
return _name;
24+
return field;
2625
}
2726
}
2827

src/Domain/HydraScript.Domain.BackEnd/Impl/Instructions/Instruction.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ namespace HydraScript.Domain.BackEnd.Impl.Instructions;
22

33
public abstract class Instruction : IExecutableInstruction
44
{
5-
private IAddress _address = null!;
6-
75
public IAddress Address
86
{
9-
get => _address;
7+
get;
108
set
119
{
1210
OnSetOfAddress(value);
13-
_address = value;
11+
field = value;
1412
}
15-
}
16-
13+
} = null!;
14+
1715
protected virtual void OnSetOfAddress(IAddress address) { }
1816

1917
public abstract IAddress? Execute(IExecuteParams executeParams);

src/Domain/HydraScript.Domain.FrontEnd/Parser/Impl/Ast/Nodes/Expressions/ComplexLiterals/ComplexLiteral.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ namespace HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Expressions.ComplexL
22

33
public abstract class ComplexLiteral : Expression
44
{
5-
private string? _nullId;
6-
75
protected string NullId
86
{
97
get
108
{
11-
_nullId ??= $"{GetHashCode()}";
12-
return _nullId;
9+
field ??= $"{GetHashCode()}";
10+
return field;
1311
}
1412
}
1513

0 commit comments

Comments
 (0)