...
This commit is contained in:
@@ -889,7 +889,6 @@ public record Variable(string Name, NubType Type, VariableKind Kind);
|
|||||||
public class Scope(string module, Scope? parent = null)
|
public class Scope(string module, Scope? parent = null)
|
||||||
{
|
{
|
||||||
private readonly List<Variable> _variables = [];
|
private readonly List<Variable> _variables = [];
|
||||||
private readonly Dictionary<string, NubType> _typeSubstitutions = [];
|
|
||||||
public string Module { get; } = module;
|
public string Module { get; } = module;
|
||||||
|
|
||||||
public void DeclareVariable(Variable variable)
|
public void DeclareVariable(Variable variable)
|
||||||
@@ -908,21 +907,6 @@ public class Scope(string module, Scope? parent = null)
|
|||||||
return parent?.LookupVariable(name);
|
return parent?.LookupVariable(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeclareTypeSubstitution(string name, NubType type)
|
|
||||||
{
|
|
||||||
_typeSubstitutions[name] = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NubType? LookupTypeSubstitution(string name)
|
|
||||||
{
|
|
||||||
if (_typeSubstitutions.TryGetValue(name, out var type))
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent?.LookupTypeSubstitution(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Scope SubScope()
|
public Scope SubScope()
|
||||||
{
|
{
|
||||||
return new Scope(Module, this);
|
return new Scope(Module, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user