Upsilon/Upsilon/Binder/BoundExpressions/BoundTableExpression.cs

39 lines
1.3 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(Type keyType, Type valueType, Dictionary<string, VariableSymbol> expressions,
ImmutableArray<BoundStatement> statements, TextSpan span) : base(span)
{
KeyType = keyType;
ValueType = valueType;
Expressions = expressions;
Statements = statements;
}
public override BoundKind Kind => BoundKind.BoundTableExpression;
public override BoundNode GetNodeAtPosition(int characterPosition)
{
foreach (var statement in Statements)
{
if (characterPosition >= statement.Span.Start && characterPosition <= statement.Span.End)
return statement.GetNodeAtPosition(characterPosition);
}
return this;
}
public override Type Type => Type.Table;
public Type KeyType { get; }
public Type ValueType { get; }
public Dictionary<string, VariableSymbol> Expressions { get; }
public ImmutableArray<BoundStatement> Statements { get; }
}
}