38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
using Upsilon.Text;
|
|
|
|
namespace Upsilon.Binder
|
|
{
|
|
public class BoundBlockStatement : BoundStatement
|
|
{
|
|
public BoundBlockStatement(ImmutableArray<BoundStatement> statements, TextSpan span) : base(span)
|
|
{
|
|
Statements = statements;
|
|
}
|
|
|
|
public override BoundKind Kind => BoundKind.BoundBlockStatement;
|
|
public override IEnumerable<BoundNode> GetNodeAtPosition(int linePosition, int characterPosition)
|
|
{
|
|
foreach (var statement in Statements)
|
|
{
|
|
if (statement.Span.Contains(linePosition, characterPosition))
|
|
{
|
|
foreach (var node in statement.GetNodeAtPosition(linePosition, characterPosition))
|
|
{
|
|
yield return node;
|
|
}
|
|
}
|
|
}
|
|
yield return this;
|
|
}
|
|
|
|
public override IEnumerable<BoundNode> GetChildren()
|
|
{
|
|
return Statements;
|
|
}
|
|
|
|
public ImmutableArray<BoundStatement> Statements { get; }
|
|
}
|
|
} |