Upsilon/Upsilon/Binder/BoundExpressions/BoundIndexExpression.cs

52 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2018-11-18 13:18:24 +00:00
using Upsilon.BaseTypes;
using Upsilon.Parser;
using Upsilon.Text;
2018-11-18 13:18:24 +00:00
namespace Upsilon.Binder
{
public class BoundIndexExpression : BoundExpression
{
2019-01-26 12:23:12 +00:00
public BoundIndexExpression(BoundExpression identifier, BoundExpression index, TypeContainer type, TextSpan span) : base(span)
2018-11-18 13:18:24 +00:00
{
Identifier = identifier;
Index = index;
Type = type;
}
public BoundExpression Identifier { get; }
2018-11-18 13:18:24 +00:00
public BoundExpression Index { get; }
public override BoundKind Kind => BoundKind.BoundIndexExpression;
2019-01-17 12:56:53 +00:00
public override IEnumerable<BoundNode> GetChildren()
{
yield return Identifier;
yield return Index;
}
public override TypeContainer Type { get; }
2018-11-18 13:18:24 +00:00
}
public class BoundFullStopIndexExpression : BoundExpression
{
public BoundExpression Expression { get; }
public string Index { get; }
public BoundFullStopIndexExpression(BoundExpression expression, string index, TypeContainer type, TextSpan span) : base(span)
{
Expression = expression;
Index = index;
Type = type;
}
public override BoundKind Kind => BoundKind.BoundFullstopIndexExpression;
2019-01-17 12:56:53 +00:00
public override IEnumerable<BoundNode> GetChildren()
{
yield return Expression;
}
public override TypeContainer Type { get; }
}
2018-11-18 13:18:24 +00:00
}