Upsilon/Upsilon/Binder/BoundExpressions/BoundTableExpression.cs

36 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Collections.Immutable;
using Upsilon.BaseTypes;
using Upsilon.Text;
namespace Upsilon.Binder
{
public class BoundTableExpression : BoundExpression
{
public BoundTableExpression(Dictionary<string, VariableSymbol> expressions,
ImmutableArray<BoundStatement> statements, TextSpan span) : base(span)
{
Expressions = expressions;
Statements = statements;
}
public override BoundKind Kind => BoundKind.BoundTableExpression;
public override IEnumerable<BoundNode> GetNodeAtPosition(int characterPosition)
{
foreach (var statement in Statements)
{
if (characterPosition >= statement.Span.Start && characterPosition <= statement.Span.End)
foreach (var boundNode in statement.GetNodeAtPosition(characterPosition))
yield return boundNode;
}
yield return this;
}
public override Type Type => Type.Table;
public Dictionary<string, VariableSymbol> Expressions { get; }
public ImmutableArray<BoundStatement> Statements { get; }
}
}