Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit c4d12b5

Browse files
committed
Classes property fix
1 parent 94aee98 commit c4d12b5

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

eiger/Execution/BuiltInTypes/Dataclass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public override Value GetAttr(ASTNode attr)
2828
if (attr.value == "type")
2929
return new String(filename, line, pos, "dataclass");
3030

31-
return symbolTable.GetSymbol(attr);
31+
return symbolTable.GetSymbol(attr, false);
3232
}
3333

3434
public override void SetAttr(ASTNode attr, Value val)
3535
{
36-
symbolTable.SetSymbol(attr, val);
36+
symbolTable.SetSymbol(attr, val, false);
3737
}
3838

3939
public override string ToString()

eiger/Execution/BuiltInTypes/Instance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public override Value GetAttr(ASTNode attr)
2929
{
3030
return createdFrom;
3131
}
32-
return symbolTable.GetSymbol(attr);
32+
return symbolTable.GetSymbol(attr, false);
3333
}
3434

3535
public override void SetAttr(ASTNode attr, Value val)
3636
{
37-
symbolTable.SetSymbol(attr, val);
37+
symbolTable.SetSymbol(attr, val, false);
3838
}
3939

4040
public override string ToString()

eiger/Execution/SymbolTable.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void CreateSymbol(string key, Value val, string filename, int line, int p
3434
/*else*/ values[key] = val;
3535
}
3636

37-
public void SetSymbol(ASTNode key, Value value) {
37+
public void SetSymbol(ASTNode key, Value value, bool checkParents = true) {
3838
try
3939
{
4040
if (key.type == NodeType.ElementAccess)
@@ -63,7 +63,7 @@ public void SetSymbol(ASTNode key, Value value) {
6363
}
6464
catch (KeyNotFoundException)
6565
{
66-
if(parent != null) parent.SetSymbol(key, value);
66+
if(parent != null && checkParents) parent.SetSymbol(key, value);
6767
else throw new EigerError(key.filename, key.line, key.pos, $"Setting to undefined symbol", EigerError.ErrorType.RuntimeError);
6868
}
6969
}
@@ -82,7 +82,7 @@ public Value GetSymbol(string key, string filename, int line, int pos) {
8282
else throw new EigerError(filename, line, pos, $"{key} is undefined", EigerError.ErrorType.RuntimeError);
8383
}
8484

85-
public Value GetSymbol(ASTNode key)
85+
public Value GetSymbol(ASTNode key, bool checkParents = true)
8686
{
8787
string err_key = "";
8888
try
@@ -121,7 +121,7 @@ public Value GetSymbol(ASTNode key)
121121
}
122122
catch (KeyNotFoundException)
123123
{
124-
if(parent != null) return parent.GetSymbol(key);
124+
if(parent != null && checkParents) return parent.GetSymbol(key);
125125
else
126126
throw new EigerError(key.filename, key.line, key.pos, $"{err_key} is undefined", EigerError.ErrorType.RuntimeError);
127127
}

0 commit comments

Comments
 (0)