File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed
Application/HydraScript.Application.StaticAnalysis/Visitors
Domain/HydraScript.Domain.BackEnd
Instructions/WithAssignment Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -268,11 +268,11 @@ public Type Visit(LexicalDeclaration visitable)
268
268
{
269
269
var assignment = visitable . Assignments [ i ] ;
270
270
var registeredSymbol = _symbolTables [ visitable . Scope ] . FindSymbol < VariableSymbol > (
271
- assignment . Destination . Id ) ;
271
+ assignment . Destination . Id ) ! ;
272
272
var sourceType = assignment . Source . Accept ( This ) ;
273
273
if ( sourceType . Equals ( undefined ) )
274
274
throw new CannotDefineType ( assignment . Source . Segment ) ;
275
- if ( ! registeredSymbol ! . Type . Equals ( undefined ) && ! registeredSymbol . Type . Equals ( sourceType ) )
275
+ if ( ! registeredSymbol . Type . Equals ( undefined ) && ! registeredSymbol . Type . Equals ( sourceType ) )
276
276
throw new IncompatibleTypesOfOperands (
277
277
assignment . Segment ,
278
278
left : registeredSymbol . Type ,
Original file line number Diff line number Diff line change @@ -2,5 +2,7 @@ namespace HydraScript.Domain.BackEnd;
2
2
3
3
public interface IAddress : IEquatable < IAddress >
4
4
{
5
- IAddress Next { get ; set ; }
5
+ public IAddress Next { get ; set ; }
6
+
7
+ public string Name { get ; }
6
8
}
Original file line number Diff line number Diff line change @@ -3,11 +3,27 @@ namespace HydraScript.Domain.BackEnd.Impl.Addresses;
3
3
public class HashAddress ( int seed ) : IAddress
4
4
{
5
5
private readonly int _seed = seed ;
6
+ private string ? _name ;
6
7
7
8
private readonly Guid _id = Guid . NewGuid ( ) ;
8
9
9
10
public IAddress Next { get ; set ; } = default ! ;
10
11
12
+ public string Name
13
+ {
14
+ get
15
+ {
16
+ if ( _name is null )
17
+ {
18
+ var baseName = $ "{ unchecked ( ( uint ) GetHashCode ( ) ) } { _id : N} ";
19
+ var nameArray = Random . Shared . GetItems ( baseName . AsSpan ( ) , 10 ) ;
20
+ _name = new string ( nameArray ) ;
21
+ }
22
+
23
+ return _name ;
24
+ }
25
+ }
26
+
11
27
public bool Equals ( IAddress ? other )
12
28
{
13
29
if ( other is HashAddress hashed )
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public Simple(
45
45
}
46
46
47
47
protected override void OnSetOfAddress ( IAddress address ) =>
48
- Left ??= $ "_t { unchecked ( ( uint ) address . GetHashCode ( ) ) } " ;
48
+ Left ??= address . Name ;
49
49
50
50
public override IAddress Execute ( IExecuteParams executeParams )
51
51
{
You can’t perform that action at this time.
0 commit comments