File tree Expand file tree Collapse file tree 5 files changed +21
-5
lines changed
src/Domain/HydraScript.Domain.IR Expand file tree Collapse file tree 5 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ namespace HydraScript.Domain.IR;
22
33public interface ISymbol
44{
5- public string Id { get ; }
5+ public SymbolId Id { get ; }
6+ public string Name { get ; }
67 public Type Type { get ; }
78}
Original file line number Diff line number Diff line change 11using System . Text ;
2+ using HydraScript . Domain . IR . Impl . SymbolIds ;
23
34namespace HydraScript . Domain . IR . Impl . Symbols ;
45
56public class FunctionSymbol (
67 string name ,
7- IEnumerable < ISymbol > parameters ,
8+ IReadOnlyCollection < ISymbol > parameters ,
89 Type type ,
910 bool isEmpty ) : Symbol ( name , type )
1011{
1112 private Type _returnType = type ;
1213 /// <summary>Тип возврата функции</summary>
1314 public override Type Type => _returnType ;
1415
16+ /// <summary>
17+ /// Перегрузка функции
18+ /// </summary>
19+ public override FunctionSymbolId Id { get ; } = new ( name , parameters . Select ( x => x . Type ) ) ;
20+
1521 public IReadOnlyList < ISymbol > Parameters { get ; } = new List < ISymbol > ( parameters ) ;
1622 public bool IsEmpty { get ; } = isEmpty ;
1723
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ namespace HydraScript.Domain.IR.Impl.Symbols;
22
33public abstract class Symbol ( string name , Type type ) : ISymbol
44{
5- public virtual string Id { get ; } = name ;
5+ public abstract SymbolId Id { get ; }
6+ public string Name { get ; } = name ;
67 public virtual Type Type { get ; } = type ;
78}
Original file line number Diff line number Diff line change 1+ using HydraScript . Domain . IR . Impl . SymbolIds ;
2+
13namespace HydraScript . Domain . IR . Impl . Symbols ;
24
3- public class TypeSymbol ( Type type , string ? id = null ) :
4- Symbol ( id ?? type . ToString ( ) , type )
5+ public class TypeSymbol ( Type type , string ? name = null ) :
6+ Symbol ( name ?? type . ToString ( ) , type )
57{
8+ public override SymbolId Id { get ; } = new TypeSymbolId ( name ?? type . ToString ( ) ) ;
9+
610 public override bool Equals ( object ? obj ) =>
711 obj is TypeSymbol typeSymbol &&
812 Id == typeSymbol . Id && Type . Equals ( typeSymbol . Type ) ;
Original file line number Diff line number Diff line change 1+ using HydraScript . Domain . IR . Impl . SymbolIds ;
2+
13namespace HydraScript . Domain . IR . Impl . Symbols ;
24
35public class VariableSymbol (
46 string name ,
57 Type type ,
68 bool readOnly = false ) : Symbol ( name , type )
79{
10+ public override SymbolId Id { get ; } = new VariableSymbolId ( name ) ;
11+
812 public bool ReadOnly { get ; } = readOnly ;
913 public bool Initialized { get ; private set ; } = readOnly ;
1014
You can’t perform that action at this time.
0 commit comments