Files
Convention-CSharp/Convention/[Symbolization]/Internal/Variable.cs

41 lines
1019 B
C#
Raw Normal View History

2025-06-30 20:20:26 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Convention.Symbolization.Internal
{
2025-06-30 21:49:33 +08:00
public abstract class Variable : ICloneable
2025-06-30 20:20:26 +08:00
{
2025-06-30 21:49:33 +08:00
public abstract object Clone();
2025-06-30 20:20:26 +08:00
}
public readonly struct VariableSymbol
{
public readonly string SymbolName;
public readonly Type VariableType;
public VariableSymbol(string symbolName, Type variableType)
{
this.SymbolName = symbolName;
this.VariableType = variableType;
}
public bool Equals(VariableSymbol other)
{
return other.SymbolName.Equals(SymbolName) && other.VariableType.Equals(VariableType);
}
public override int GetHashCode()
{
return new Tuple<string, Type>(SymbolName, VariableType).GetHashCode();
}
}
public class VariableContext
{
public Dictionary<VariableSymbol, Variable> Variables = new();
}
}