Skip to content

Commit d93b2ca

Browse files
committed
#61 - Symbol ctor param id -> name
1 parent ee5ab17 commit d93b2ca

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/Application/HydraScript.Application.StaticAnalysis/Visitors/DeclarationVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public VisitUnit Visit(FunctionDeclaration visitable)
7272
var parameters = visitable.Arguments.Select(x =>
7373
{
7474
var arg = new VariableSymbol(
75-
id: x.Key,
75+
name: x.Key,
7676
x.TypeValue.Accept(_typeBuilder));
7777
arg.Initialize();
7878
_symbolTables[visitable.Scope].AddSymbol(arg);

src/Domain/HydraScript.Domain.IR/Impl/Symbols/FunctionSymbol.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace HydraScript.Domain.IR.Impl.Symbols;
44

55
public class FunctionSymbol(
6-
string id,
6+
string name,
77
IEnumerable<ISymbol> parameters,
88
Type type,
9-
bool isEmpty) : Symbol(id, type)
9+
bool isEmpty) : Symbol(name, type)
1010
{
1111
private Type _returnType = type;
1212
/// <summary>Тип возврата функции</summary>

src/Domain/HydraScript.Domain.IR/Impl/Symbols/ObjectSymbol.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace HydraScript.Domain.IR.Impl.Symbols;
44

55
public class ObjectSymbol(
6-
string id,
6+
string name,
77
ObjectType objectType,
8-
bool readOnly = false) : VariableSymbol(id, objectType, readOnly)
8+
bool readOnly = false) : VariableSymbol(name, objectType, readOnly)
99
{
1010
public override ObjectType Type { get; } = objectType;
1111
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace HydraScript.Domain.IR.Impl.Symbols;
22

3-
public abstract class Symbol(string id, Type type) : ISymbol
3+
public abstract class Symbol(string name, Type type) : ISymbol
44
{
5-
public virtual string Id { get; } = id;
5+
public virtual string Id { get; } = name;
66
public virtual Type Type { get; } = type;
77
}

src/Domain/HydraScript.Domain.IR/Impl/Symbols/VariableSymbol.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace HydraScript.Domain.IR.Impl.Symbols;
22

33
public class VariableSymbol(
4-
string id,
4+
string name,
55
Type type,
6-
bool readOnly = false) : Symbol(id, type)
6+
bool readOnly = false) : Symbol(name, type)
77
{
88
public bool ReadOnly { get; } = readOnly;
99
public bool Initialized { get; private set; } = readOnly;

tests/HydraScript.UnitTests/Application/FunctionWithUndefinedReturnStorageTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void StorageIsEmptyAfterFlushTest()
1818
IFunctionWithUndefinedReturnStorage storage = new FunctionWithUndefinedReturnStorage();
1919

2020
var symbol = new FunctionSymbol(
21-
id: FunctionName,
21+
name: FunctionName,
2222
parameters: [],
2323
"undefined",
2424
isEmpty: false);
@@ -68,27 +68,27 @@ public void StorageIsCorrectOrderTest()
6868
IFunctionWithUndefinedReturnStorage storage = new FunctionWithUndefinedReturnStorage();
6969

7070
var removable = new FunctionSymbol(
71-
id: "key2",
71+
name: "key2",
7272
parameters: [],
7373
"undefined",
7474
isEmpty: false);
7575

7676
storage.Save(new FunctionSymbol(
77-
id: "key1",
77+
name: "key1",
7878
parameters: [],
7979
"undefined",
8080
isEmpty: false), declaration: declarations[0]);
8181

8282
storage.Save(removable, declaration: declarations[1]);
8383

8484
storage.Save(new FunctionSymbol(
85-
id: "key3",
85+
name: "key3",
8686
parameters: [],
8787
"undefined",
8888
isEmpty: false), declaration: declarations[2]);
8989

9090
storage.Save(new FunctionSymbol(
91-
id: "key4",
91+
name: "key4",
9292
parameters: [],
9393
"undefined",
9494
isEmpty: false), declaration: declarations[3]);

0 commit comments

Comments
 (0)