42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using Upsilon.BaseTypes;
|
|
using Upsilon.Text;
|
|
|
|
namespace Upsilon.Binder
|
|
{
|
|
public class BoundFunctionCallExpression : BoundExpression
|
|
{
|
|
public BoundExpression Identifier { get; }
|
|
public ImmutableArray<BoundExpression> Parameters { get; }
|
|
|
|
public BoundFunctionCallExpression(BoundExpression identifier, ImmutableArray<BoundExpression> parameters,
|
|
TextSpan span) : base(span)
|
|
{
|
|
Identifier = identifier;
|
|
Parameters = parameters;
|
|
}
|
|
|
|
public override BoundKind Kind => BoundKind.BoundFunctionCallExpression;
|
|
public override IEnumerable<BoundNode> GetNodeAtPosition(int characterPosition)
|
|
{
|
|
if (characterPosition >= Identifier.Span.Start && characterPosition <= Identifier.Span.End)
|
|
{
|
|
foreach (var exp in Identifier.GetNodeAtPosition(characterPosition))
|
|
{
|
|
yield return exp;
|
|
}
|
|
}
|
|
foreach (var parameter in Parameters)
|
|
{
|
|
if (characterPosition >= parameter.Span.Start && characterPosition <= parameter.Span.End)
|
|
{
|
|
foreach (var boundNode in parameter.GetNodeAtPosition(characterPosition)) yield return boundNode;
|
|
}
|
|
}
|
|
yield return this;
|
|
}
|
|
|
|
public override Type Type => Type.Unknown;
|
|
}
|
|
} |