using System.Linq.Expressions; using Connected.Expressions.Expressions; using Connected.Expressions.Visitors; namespace Connected.Expressions.Translation.Resolvers; internal sealed class ReferencedAliasesResolver : DatabaseVisitor { private ReferencedAliasesResolver() { Aliases = new(); } private HashSet Aliases { get; } public static HashSet Resolve(Expression source) { var resolver = new ReferencedAliasesResolver(); resolver.Visit(source); return resolver.Aliases; } protected override Expression VisitColumn(ColumnExpression column) { Aliases.Add(column.Alias); return column; } }